[SOLVED] CocosBuilder integration problem

Hi!

After loading a ccbi file I want to run a specific animation

void HelloWorldScene::onNodeLoaded(CCNode * pNode, CCNodeLoader * pNodeLoader) {
    CCLOG("NODE LOADED");
    CCBAnimationManager *man = dynamic_cast( this->getUserObject());

    if (man)
    {
        CCLOG("Animation manager");
        man->runAnimationsForSequenceNamed("Hit");
    } else CCLOG("NOT Animation manager");
}

The cast fails so I get “NOT Animation manager” with cocos2d-x 2.1.4 with cocos builder 3.0 alpha5.

I have solved my issue.

It all depends on the way ccbreader loads a ccbi and sets the userObject.

The order is:

1- load the node tree
2- call onNodeLoaded method
3- appends the animation managers looping through the nodes

When onNodeLoaded the userObject is not yet set so I get a null dynamic_cast

Hope this info will help.

Bye,
Massimo