composer overlay

Hey,

I have started working on a biz app last week and I use the Composer api in this project.

One of the main parts is based on a sceneOverlay which is display almost 100% of the time.

When I switch the scenes for some reason this overlay scene calls it´s “scene:destroy” event. However, the overlay scene remains on screen and I can access it without a problem.

Well in the last blog post regarding the new composer api someone implied that the overlay function is a little bit different than the storyboard version and that this will be featured in a future tutorial…

So is this a bug with composer or is this the correct behaviour that will be explained in this upcoming tutorial?

Max / CineTek

The only real difference is in how overlay’s communicate back with the parent scene to let the parent scene know the overlay is done or the overlay has shown.  We dropped the events overlayBegan and overlayEnded.  Instead the parent’s scene object is included in the event table sent to the create, show and hide events.  The overlay can then call any functions you’ve created in the scene that you attached to the scene object:

– parent scene

function scene:doSomethingAwesome(someParameters)

     – do something awesome with someParameters

end

Then in the overlay you can access that function:

      event.parent:doSomethingAwesome(“How Cool is This”)

So no longer are you really limited to only letting the parent know if you’ve shown or hidden, but you can now have other interactions in the overlay that knows about things going on in the parent scene. 

Now to your problem…      The scene:destroy() is happening because the overlay is trying to hide.  If you do a gotoScene() from an overlay, it attempts to call composer.hideOverlay() which destroy’s the scene along the way. 

Now as to why it’s not working, the obvious answer to tell new users is to make sure you’re putting everything in the scene’s view group, but you’re not a new user, so that tends to point to a potential bug.  I’m not sure I’ve ever tried to do a gotoScene() from an overlay before.  I generally hideOverlay() to get rid of it. 

Rob

Thanks Rob,

but I am calling composer.gotoScene from my widget tabs and not directly through the overlay scene. 

Edit2: I will look into it tomorrow when I can concentrate again. If I can´t find the issue then I will fill in a bug report and/or send you a test project :wink:

Max

Remember an overlay is really designed to be a temporary “popup” type object.  Hopefully one day we can have a stack based system, but if you’re going to be doing a lot of “gotoScene” calls, perhaps you don’t want an overlay but a regular scene.

Rob

Hm, yeah. But as you pointed out, Corona is not capable of having multiple independent scenes on screen at the same time.

I wonder what my options are then. I mean, at this point in development I do not have to care about the destroyScene call at all since the timers etc are still working… Lets see tomorrow what happens when I try to call some functions from this overlay scene :wink:

Max

The only real difference is in how overlay’s communicate back with the parent scene to let the parent scene know the overlay is done or the overlay has shown.  We dropped the events overlayBegan and overlayEnded.  Instead the parent’s scene object is included in the event table sent to the create, show and hide events.  The overlay can then call any functions you’ve created in the scene that you attached to the scene object:

– parent scene

function scene:doSomethingAwesome(someParameters)

     – do something awesome with someParameters

end

Then in the overlay you can access that function:

      event.parent:doSomethingAwesome(“How Cool is This”)

So no longer are you really limited to only letting the parent know if you’ve shown or hidden, but you can now have other interactions in the overlay that knows about things going on in the parent scene. 

Now to your problem…      The scene:destroy() is happening because the overlay is trying to hide.  If you do a gotoScene() from an overlay, it attempts to call composer.hideOverlay() which destroy’s the scene along the way. 

Now as to why it’s not working, the obvious answer to tell new users is to make sure you’re putting everything in the scene’s view group, but you’re not a new user, so that tends to point to a potential bug.  I’m not sure I’ve ever tried to do a gotoScene() from an overlay before.  I generally hideOverlay() to get rid of it. 

Rob

Thanks Rob,

but I am calling composer.gotoScene from my widget tabs and not directly through the overlay scene. 

Edit2: I will look into it tomorrow when I can concentrate again. If I can´t find the issue then I will fill in a bug report and/or send you a test project :wink:

Max

Remember an overlay is really designed to be a temporary “popup” type object.  Hopefully one day we can have a stack based system, but if you’re going to be doing a lot of “gotoScene” calls, perhaps you don’t want an overlay but a regular scene.

Rob

Hm, yeah. But as you pointed out, Corona is not capable of having multiple independent scenes on screen at the same time.

I wonder what my options are then. I mean, at this point in development I do not have to care about the destroyScene call at all since the timers etc are still working… Lets see tomorrow what happens when I try to call some functions from this overlay scene :wink:

Max