Composer and Overlays

I noticed that when I try to hide an overlay, trying both hideOverlay(true) and hideOverlay(false), the destroy event fires.  Is this by design?

Since I use a particular overlay many times, I don’t really want to re-create it over and over.

Thanks,

–John

Actually this is the expected behavior:

composer.hideOverlay(true)  – just removes the view (and destroy will be called before the view is removed…

composer.hideOverlay(false) or composer.hideOverlay(nil) – removes the view (calling destroy first) and then when done, it UN-requires the module. 

There is no way to keep the scene’s view around.

Rob

Thanks for the reply Rob,

I noticed the following text here, and I think this is what is confusing me (bolding the section that throws me):

recycleOnly (optional)

Boolean. If set to true, the scene will only be recycled (the self.view display group will be removed, but the scene object will remain in memory).  Setting this to true is useful if you intend to show the overlay again in the near future.  Default is false, meaning that the overlay scene will be completely removed, including its scene object.

So, if I understand your answer, I should use hideOverlay(true), and still expect the destroy event to fire?

Since the create event fires the next time I want to show the overlay, all my display objects are recreated, so I am wondering what the benefit is using the true parameter.  If you don’t mind me asking to clarify?

Thanks again for your help,

–john

Right, it keeps the module in memory and only free’s up the view.  However before we can free up the view, we have to call the destroy event to give you a chance to do anything that might reference a display object that we are about to get rid of.   The rest of the module stays in memory.

EDIT to add: There is cost to load a module in addition to the cost of creating the display objects.  That’s why we give you the choice to save having to dump and recreate the entire module.

Rob

Actually this is the expected behavior:

composer.hideOverlay(true)  – just removes the view (and destroy will be called before the view is removed…

composer.hideOverlay(false) or composer.hideOverlay(nil) – removes the view (calling destroy first) and then when done, it UN-requires the module. 

There is no way to keep the scene’s view around.

Rob

Thanks for the reply Rob,

I noticed the following text here, and I think this is what is confusing me (bolding the section that throws me):

recycleOnly (optional)

Boolean. If set to true, the scene will only be recycled (the self.view display group will be removed, but the scene object will remain in memory).  Setting this to true is useful if you intend to show the overlay again in the near future.  Default is false, meaning that the overlay scene will be completely removed, including its scene object.

So, if I understand your answer, I should use hideOverlay(true), and still expect the destroy event to fire?

Since the create event fires the next time I want to show the overlay, all my display objects are recreated, so I am wondering what the benefit is using the true parameter.  If you don’t mind me asking to clarify?

Thanks again for your help,

–john

Right, it keeps the module in memory and only free’s up the view.  However before we can free up the view, we have to call the destroy event to give you a chance to do anything that might reference a display object that we are about to get rid of.   The rest of the module stays in memory.

EDIT to add: There is cost to load a module in addition to the cost of creating the display objects.  That’s why we give you the choice to save having to dump and recreate the entire module.

Rob