I’m looking through the Cocos2d-x HTML5 examples and haven’t been able to locate any good examples of Scene management where for example:
-
A scene is loaded into the memory which itself builds a series of sprite anamations and onTouch callbacks.
-
Upon navigating to the next scene the previous scene is released from memory.
-
Upon navigating back to the previous scene the child assets are reconstructed.
I’m probably approaching this wrong and would love any input. Have tried many options inserted to my original scene’s onExit function like:
this.getParent().removeChild(this,true); // removes this scene from memory on exit?
AnySceneBuiltSprite.removeFromParent( true ); // i’ve added this into onExit and applied it to every single sprite created by the scene
Also when i’ve tried these above solutions something is compounding the memory… maybe the animationCache i don’t know. Any memory debugging function recommendations would be great too. I’m working on this in Eclipse at the moment.
Lastly, A tutorial focusing on memory management and with a range of memory release examples would be simply awesome and solve a lot of newcomers issues.