Cocos Creator之Animation动画事件

private onOK(): void{
    log("ok");
}
start () {
    // [3]
    let sp: Node = <Node>this.node.getChildByName( "Sprite" );
    this.mc = sp.getComponent( Animation ) as Animation;
    this.mc.on(  AnimationComponent.EventType.FINISHED, this.onOK, this );
    this.mc.play("anim");
}


事件类型在 : AnimationComponent.EventType枚举中,这玩意比手写string好多了node

引擎 3.0.0ide

相关文章
相关标签/搜索