Passing Data To and From CocosBuilder Scenes / Layers

Passing Data To and From CocosBuilder Scenes / Layers
0.0 0


I am using CocosBuilder just like the TestCPP project does.

I have two CocosBuilder CCBI files, MenuA and MenuB.

I would like to pass information from MenuA to MenuB when a CCControlEvent is launched in MenuA.

I have accomplished this for basic data with shared static classes, but it is ugly.

Can someone help me brainstorm different ways to pass information between scenes / CCBI?

This is how I am currently creating MenuB inside of MenuA:

CCScene *pScene = MenuB::create();


Maybe putting it in terms of the TestCPP code will help?

We have this class

class HelloCocosBuilderLayer

which has a CCControlEvent

void onMenuTestClicked(cocos2d::CCObject * pSender, cocos2d::extension::CCControlEvent pCCControlEvent);

That CCControlEvent launches a new CCScene that contains another CocosBuilder layer.

In MenuTestLayer.cpp, which is created from onMenuTestClicked(…) there are several buttons.

My question is this …

How can the code return to HelloCocosBuilderLayer the menu button that was clicked in MenuTestLayer?