I can’t understand this:
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
this._super();
cc.log(this.getParent());//Get null <--------------- ?
var closeItem = new cc.MenuItemImage(
res.CloseNormal_png,
res.CloseSelected_png,
function () {
cc.log("Menu is clicked!");
this.whenRunAgain();
}, this);
},
whenRunAgain:function(){
cc.log(this.getParent());//This Works fine <--------------- ?
},
});
var HelloWorldScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new HelloWorldLayer();
this.addChild(layer);
}
});
