http://blog.sina.com.cn/s/blog_7dbac1250102v0fs.html
标签: @H_301_15@ 股票 | 分类:Cocos2d-js |
1、给一个Layer添加触摸事件,前提需要在cocos studio当中吧panel的交互去掉,不然会不能自定义其触摸事件,
cc.eventManager.addListener({
prevTouchId: -1,
event: cc.EventListener.TOUCH_ALL_AT_ONCE,255)">
onTouchesEnded:function (touches,event) {
var touch = touches[0];
cc.log("onTouchesEnded");
}
},this);
var root = ccs.uiReader.widgetFromJsonFile(res.game01Controller_json);
this.addChild(root,1);
this.btn_darts=ccui.helper.seekWidgetByName(root,"btn_darts");
this.btn_darts .addTouchEventListener(this.dartsTouchEvent,this);
this.setTextureRect(cc.rect(196,2,52,42));