I have a simple question about storyboard.PurgeScene and avoiding memory leaks. I can arrive to Scene4 via several scenes (scene4zpanel, scene1, scene3). Is it better to list the purgeScenes this like this? Or set up a global variable and do if/then statement to test for previous scene (Only purging the previous). Or would purgall be more appropriate since I only have 1 out 3 scenes to really purge at any given time.
I use this piece of code in the ‘scene enter’ part of my game over scene, as my current app needs to reload the game scene every time it is called. Maybe you can do something like this instead of listing all the scenes to purge / remove.
[lua]function scene:enterScene( event )
local group = self.view
– get the name of the last scene
local lastScene = storyboard.getPrevious()
– remove the last scene
storyboard.removeScene(lastScene)
end[/lua] [import]uid: 62706 topic_id: 32184 reply_id: 128126[/import]
I use this piece of code in the ‘scene enter’ part of my game over scene, as my current app needs to reload the game scene every time it is called. Maybe you can do something like this instead of listing all the scenes to purge / remove.
[lua]function scene:enterScene( event )
local group = self.view
– get the name of the last scene
local lastScene = storyboard.getPrevious()
– remove the last scene
storyboard.removeScene(lastScene)
end[/lua] [import]uid: 62706 topic_id: 32184 reply_id: 128126[/import]