当我推送一个尝试更改场景的菜单项时,我从 Chrome 控制台收到此错误消息:
Uncaught TypeError: object is not a function CCMenuItem.js:174
cc.MenuItem.cc.Node.extend.activate CCMenuItem.js:174
cc.MenuItemLabel.cc.MenuItem.extend.activate CCMenuItem.js:333
(anonymous function) CCClass.js:138
cc.Menu.cc.Layer.extend.onTouchEnded CCMenu.js:442
cc.TouchDispatcher.cc.Class.extend.touches CCTouchDispatcher.js:376
cc.TouchDispatcher.cc.Class.extend.touchesEnded CCTouchDispatcher.js:508
cc.ProcessMouseupEvent CCTouchDispatcher.js:630
(anonymous function)
这是我的菜单代码:
var menuItem1 = new cc.MenuItemFont.create("Play",this,this.onPlay);
var size = cc.Director.getInstance().getWinSize();
menuItem1.setPosition(new cc.Point(size.width/2,size.height/2+50));
var menu = cc.Menu.create(menuItem1);
menu.setPosition(new cc.Point(0,0));
this.addChild(menu);
以及 menuitem1 的功能:
onPlay:function(){
//cc.log("==onplay clicked");
//var director = cc.Director.getInstance();
//director.replaceScene(new MainLayer());
}