CocosBuilder- Custom class Problem

CocosBuilder- Custom class Problem
0.0 0


my step is this:

1: open cocosBuilder editor, create one file Level, that extends CCLayer.
2: create one file named Dragon, that extends CCNode.
3. in Dragon File, I make an bone animation.
4. I drag the Dragon file into Level File. click the Dragon node in Level File, set Doc root var is dragon, and before in Dragon file, set Custom class is Dragon.
5. save & publish.

in Xcode.

  1. I create Level.h , Level.cpp, LevelLoader.h ., create Dragon.h , Dragon.cpp

void Level::openTest(const char * pCCBFileName, const char * pCCNodeName, CCNodeLoader * pCCNodeLoader) {
/* Create an autorelease CCNodeLoaderLibrary. /
ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();

if {
ccNodeLoaderLibrary~~>registerCCNodeLoader(pCCNodeName, pCCNodeLoader);

/* Create an autorelease CCBReader. /
ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
/* Read a ccbi file. /
// Load the scene from the ccbi-file, setting this class as
// the owner will cause lblTestTitle to be set by the CCBReader.
// lblTestTitle is in the TestHeader.ccbi, which is referenced
// from each of the test scenes.
node = ccbReader~~>readNodeGraphFromFile(pCCBFileName, this);


CCScene * scene = CCScene::create();
if(node != NULL) {
/* Push the new scene with a fancy transition. */
ccColor3B transitionColor;
transitionColor.r = 0;
transitionColor.g = 0;
transitionColor.b = 0;

the bug tell me that: can not find “Dragon” class…
CCNodeLoader * CCNodeLoaderLibrary::getCCNodeLoader {
CCNodeLoaderMap::iterator ccNodeLoadersIterator = this~~>mCCNodeLoaders.find;
return ccNodeLoadersIterator~~>second;


by the way, i run in cocos2d-iphone is ok.

can u help me !~~ thanks .


another problem is that. use timeline to make animation, whatever use Bone animation or Sprite Frame Animation, when runing in xcode,…
i make CCMoveTo Action, if move duration is little long, such as 2 seconds, the object stoped before get to the destination point.

it’s happend in cocos2d-x & cocos2d-iphone .

it’s boring me


Hey Tony,

Did you get the solution for the custom class? I am looking for the same.



Never mind, I found the solution on my own.


very simple to solve the problem.

you need to write a CCLayerLoader your self.

CCNodeLoaderLibrary ll = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary;
ccbReader = new CCBReader(ll);

class Demo05BuilderLoader : public CCLayerLoader


hey guys

I’m having the same problem here, can’t seem to connect a ccbi file to a custom class.

I’ve followed all the instructions here, and have pretty much copied the entire code for my custom class, custom class loader from the testcpp example.
I’ve set the cclayer in my ccbi file to the correct name, I’ve cleaned my project and triple published, I’m out of ideas.

I’m using cocosbuilder 3 (alpha) and cocos2dx cocos2d-2.1rc0-x-2.1.2.

any fresh ideas would be much appreciated!


any one knows how to write custom class loader in lua? thanks