Model overlay window button stays on screen after composer.hideOverlay is called

Hi,

I have a model overlay window that has a close button. The close button is parented to the overlay scene’s sceneGroup. The button stays on screen after composer.hideOverlay is called. Am I supposed to hide it manually inside  scene:hide(event)?

– overlayWindow.lua

 closeButton = widget.newButton

   {

       parent = sceneGroup,

       width = 111,

       height = 115,

       defaultFile = “art/closeButton.png”,

       overFile = “art/closeButton.png”,

       onPress = onButtonTap

   }

local function onButtonTap(event)

   composer.hideOverlay( )

end 

Hi @sillyplayground,

The “parent” parameter is not valid within the widget button constructor. You should create the button and then insert it into the scene group using :insert() like this:

[lua]

sceneGroup:insert( closeButton )

[/lua]

Here are the docs on widget buttons for your reference:

http://docs.coronalabs.com/api/library/widget/newButton.html

Best regards,

Brent

Thanks.

Hi @sillyplayground,

The “parent” parameter is not valid within the widget button constructor. You should create the button and then insert it into the scene group using :insert() like this:

[lua]

sceneGroup:insert( closeButton )

[/lua]

Here are the docs on widget buttons for your reference:

http://docs.coronalabs.com/api/library/widget/newButton.html

Best regards,

Brent

Thanks.