var GameLayer = cc.Layer.extend({
_bird:null,
_value: 0,
ctor:function () {
//////////////////////////////
// 1. super init first
this._super();
this.initBackground();
this._bird = new Bird();
this.addChild(this._bird, 100, BIRDTAGVALUE);
this._value = "aaaa";
cc.eventManager.addListener({
event:cc.EventListener.TOUCH_ONE_BY_ONE,
swallTouches: true,
onTouchBegan: this.onTouchBegan
}, this)
return true;
},
onTouchBegan : function(touch, event){
var touches = touch.getLocation();
if(touches){
cc.log("onTouchBegan");
cc.log(this._bird);
cc.log(this._value);
}
},
为什么 我在触摸的事件里只是输出是第一行的,后面两个都是输出 undefined