cc.Class({
extends: cc.Component,
properties: {
},
// use this for initialization
onLoad: function () {
this.registerTouch()
},
registerTouch:function () {
var self=this
cc.eventManager.addListener({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
//开始
onTouchBegan: function(touch, event) {
cc.log("began")
return true; // don't capture event
},
//移动
onTouchMoved: function( touch, event) {
cc.log("moved")
},
//结束
onTouchEnded: function(touch, event) {
cc.log("end")
}
}, self.node);
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});