What is the best way to make a popup menu to be used in multiple scenes?

Hello,

I want to make a popup menu to call from any scene and show. Can someone tell me how to do this? I believe I can code it in its own LUA file but then what? How do I include it?

Also, when I leave a scene to go to another I do a removeSelf on all objects in the scene. So would I do this on the objects of the menu also?

Thanks,

Warren

I just found this page. Would I do it like this with the functions?

https://coronalabs.com/blog/2012/08/28/how-external-modules-work-in-corona/

Warren,

I’m out of time to help today, but I may revisit this tomorrow.  

However, you could start with the validation code for this SSK2 feature:

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/dialogs/#custom-trays

You’ve got SSK2 right?  If yes, look in the validation folder to find the dialog trays example.

Thanks but I was trying to follow the tutorial I shared and it works but the menu (part I did) shows behind the current scene in the back. I tried calling toFront() and that did nothing. Does anyone know why? I called the require at the beginning and then changed to end of scene and same also.

Menu LUA file:

local t = {} t.showMenu = function() imgBack = display.newImageRect( "images/imgShadow.png", 450, 0 ) imgBack.anchorX = 0 imgBack.anchorY = 0 imgBack.x = 0 imgBack.y = 0 imgBack:toFront() end return t

Called it like this from scene to show menu in.

local function btnMenuButtonEvent( event ) if ("ended" == event.phase ) then examp2 = require ( "sceneMenu" ) examp2.showMenu() end end

I just found this page. Would I do it like this with the functions?

https://coronalabs.com/blog/2012/08/28/how-external-modules-work-in-corona/

Warren,

I’m out of time to help today, but I may revisit this tomorrow.  

However, you could start with the validation code for this SSK2 feature:

https://roaminggamer.github.io/RGDocs/pages/SSK2/libraries/dialogs/#custom-trays

You’ve got SSK2 right?  If yes, look in the validation folder to find the dialog trays example.

Thanks but I was trying to follow the tutorial I shared and it works but the menu (part I did) shows behind the current scene in the back. I tried calling toFront() and that did nothing. Does anyone know why? I called the require at the beginning and then changed to end of scene and same also.

Menu LUA file:

local t = {} t.showMenu = function() imgBack = display.newImageRect( "images/imgShadow.png", 450, 0 ) imgBack.anchorX = 0 imgBack.anchorY = 0 imgBack.x = 0 imgBack.y = 0 imgBack:toFront() end return t

Called it like this from scene to show menu in.

local function btnMenuButtonEvent( event ) if ("ended" == event.phase ) then examp2 = require ( "sceneMenu" ) examp2.showMenu() end end