var pl = cc.Layer.extend({
ctor:function(){
this._super();
var sendbtn = new cc.Sprite(res.Ready_button);
sendbtn.attr({
x: size.width / 2,
y: size.height - 100
});
cc.eventManager.addListener( cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function(touch, event){
var target = event.getCurrentTarget();
var pos = touch.getLocation();
if (cc.rectContainsPoint(target.getBoundingBox(),pos)){
layers.pl.sendCard();
}
}
}), sendbtn);
this.addChild(sendbtn);
return true;
},
sendCard:function(){
}
});
提示说layers undefined
改成cc.layers.sendCard() this.sendCard()都不对
应该怎么调用?
顺路问下,sendCard函数我想做成一个公用的函数,不止在这个场景中用,其它场景都可能用到,可不可以把它做成个公共库之类的?求教!