Reload parent scene from an Overlay

Hi guys, I’m building a game and I got stuck. This is the problem: After the player loses an overlay is shown, it shows how many points he has made, and it has a button to restart. I’ve been googling a bit and found this thread: How to reload a scene and proceed like normal?. (btw, I’m using composer not storyboards)

So in that thread the advice is to do something like this:

main.lua (not a real scene but starts the whole process) --> menu.lua --> level1.lua --> tryagain.lua --> level1.lua

My “tryagain.lua” is not an scene, it’s an overlay that let’s the user see the parent scene. So if in the handler of my “again” button I do something like this:

handleAgain = function (event) if ( "ended" == event.phase) then composer.removeScene("scene"); composer.gotoScene("scene"); end end 

I get a black screen. How should I handle this???

Thanks a lot!!

I’m not sure the best practice to reload the parent scene from the overlay.   Reloading scenes either requires you to use a “cut” scene so you can remove and then go back to the scene or you have to use just create your objects in the scene:create() and reposition/reset them in the scene:show()'s will phase.

For an Overlay scene to do it, you would have to have a function in the parent scene that did your reset and then you can call the parent’s reset function.  See the Composer guide’s section on accessing the parent scene:  http://docs.coronalabs.com/guide/system/composer/index.html#overlays

As for the black screen, there are 99 times out of 100 a message in your console log.  Please see the Basic Debugging tutorial at to learn out to view these messages and understand what they mean.

Rob

I’m not sure the best practice to reload the parent scene from the overlay.   Reloading scenes either requires you to use a “cut” scene so you can remove and then go back to the scene or you have to use just create your objects in the scene:create() and reposition/reset them in the scene:show()'s will phase.

For an Overlay scene to do it, you would have to have a function in the parent scene that did your reset and then you can call the parent’s reset function.  See the Composer guide’s section on accessing the parent scene:  http://docs.coronalabs.com/guide/system/composer/index.html#overlays

As for the black screen, there are 99 times out of 100 a message in your console log.  Please see the Basic Debugging tutorial at to learn out to view these messages and understand what they mean.

Rob