ios - Cannot access CCArray from another method -


i'm new cocos2d-x , had pass array between 2 ccscenes. did , got so:

ccscene* classicmodelayer::scene(ccarray *boltarray) {     // 'scene' autorelease object     ccscene *scene = ccscene::create();      // 'layer' autorelease object     classicmodelayer *layer = classicmodelayer::create();      // add layer child scene     scene->addchild(layer);      layer->mcolorarray = ccarray::createwithcapacity(boltarray->count());     layer->mcolorarray->addobjectsfromarray(boltarray);     mcolorarray->retain();      return scene; } 

but when i'm trying access mcolorarray in method so:

ccinteger *value = (ccinteger*) mcolorarray->objectatindex(0); 

but crashes. i'm guessing memory allocation being released. there else should doing? tried retaining array. didnt work.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -