cocos2d-x JSB中可以使用CCControlButton码?

代码如下

var MainMenu = function(){};

MainMenu.prototype.onDidLoadFromCCB = function()
{
cc.log(“file loaded “+this.Index+”,”+this.Function+","+this.Bag+","+this.Shop);
};

MainMenu.prototype.onBattle = function()
{
alert(“点击战斗”);
};

var MyScene = cc.Scene.extend({
ctor:function () {
this._super();

    var node=cc.BuilderReader.load("res/CCB/主界面.ccbi");

    if(node != null) {
        this.addChild(node);
    }

    this.setPosition(cc.p(0, 0));

}

});

但是运行的时候会跑出错误
TypeError: callbackNode is undefined extensions/CCBReader/CCBReader.js:979

我看了一下,具体是在CCBReader中的load方法里

// Callbacks
var documentCallbackNames = animationManager.getDocumentCallbackNames();
var documentCallbackNodes = animationManager.getDocumentCallbackNodes();
for (j = 0; j < documentCallbackNames.length; j++) {
callbackName = documentCallbackNames;
callbackNode = documentCallbackNodes;

        callbackNode.setCallback(controller, controller);
    }

documentCallbackNodes是空数组

  • 本帖最后由 lp43 于 2013-9-15 09:40 编辑 *

cocos2d-x 3.0版才?始支援

??我?了我如何用3.0版使用CCControlButton元件的http://lp43-cocos2dx.blogspot.tw/2013/08/cocos2dx-jsbcccontrolbutton.html。