Purge Scene problem

I am trying to purge one of my scenes in my app but it is not working . Can someone help ? 

-- requires local storyboard = require( "storyboard" ) local scene = storyboard.newScene() -- background function scene:createScene(event) local screenGroup = self.view local myText = display.newText( "Touch Screen To Restart", 20, 100, native.systemFont, 26 ) myText:setFillColor( 0, 1, 1 ) end function touchScreen( event ) if event.phase == "began" then storyboard.purgeScene("game") storyboard.gotoScene("game", "fade", 400) end end function scene:enterScene(event) Runtime:addEventListener("touch", touchScreen) end function scene:exitScene(event) Runtime:removeEventListener("touch", touchScreen) end function scene:destroyScene(event) end scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene) return scene

Are you trying to purge the same scene you are in?  i.e. Is the above a separate scene or is that ‘game’?

If that is ‘game’, you can’t navigate to the same scene you’re in.

The scene I want to purge is my game scene

Yeah, I got that.  Is the code above from another scene or the game scene?

If you’re in ‘game’ scene, you can’t purge ‘game’ scene.  You need to go to another scene, then purge ‘game’.  Also, purging isn’t generally the best way to handle this.

Also,  it is, hard to help w/ storyboard questions because the docs are buried (i.e. not in daily API listing).

I strongly suggest taking a few minutes to an hour and switching your project over to composer.

Then, take a look at these examples (specifically #9):

 

http://github.com/roaminggamer/CoronaGeek/raw/master/Hangouts/composer_scene_manager.zip

Here’s a link to help you convert: https://docs.coronalabs.com/daily/api/library/composer/migration.html

However, to make it really simple, you can use the framework that comes with my set of examples.  I’ve written it to have a very similar organization to storyboard.

Are you trying to purge the same scene you are in?  i.e. Is the above a separate scene or is that ‘game’?

If that is ‘game’, you can’t navigate to the same scene you’re in.

The scene I want to purge is my game scene

Yeah, I got that.  Is the code above from another scene or the game scene?

If you’re in ‘game’ scene, you can’t purge ‘game’ scene.  You need to go to another scene, then purge ‘game’.  Also, purging isn’t generally the best way to handle this.

Also,  it is, hard to help w/ storyboard questions because the docs are buried (i.e. not in daily API listing).

I strongly suggest taking a few minutes to an hour and switching your project over to composer.

Then, take a look at these examples (specifically #9):

 

http://github.com/roaminggamer/CoronaGeek/raw/master/Hangouts/composer_scene_manager.zip

Here’s a link to help you convert: https://docs.coronalabs.com/daily/api/library/composer/migration.html

However, to make it really simple, you can use the framework that comes with my set of examples.  I’ve written it to have a very similar organization to storyboard.