标签:ext 点击事件 this class load() ons export click handler
const {ccclass, property} = cc._decorator;
@ccclass
export default class TestButton extends cc.Component{
private _button:cc.Button=null;
protected onLoad():void{
super.onLoad();
this._button=this.getComponent(cc.Button);
var eventHandler=new cc.Component.EventHandler();
eventHandler.target=this.node;
eventHandler.component="TestButton";
eventHandler.handler="onClick";
eventHandler.customEventData="my data";
this._button.clickEvents.push(eventHandler);
}
private onClick(event:cc.Event.EventTouch,customData:any):void{
}
}
标签:ext 点击事件 this class load() ons export click handler
原文地址:https://www.cnblogs.com/kingBook/p/12956437.html