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