showOverlay Error (storyboard.lua:1367: attempt to index upvalue 'touchOverlay' (a nil value))

Hey guys, i want to make a popup window / pause overlay in my game and i found code for a showOverlay with storyboard.

Here is my example code.

This is my button:

local mybutton = display.newRect(display.contentCenterX, 300, 100, 100) mybutton:setFillColor(0, 0, 1) mybutton:addEventListener("touch", btnTap) sceneGroup:insert(mybutton)

And here the listener:

local function btnTap(event) storyboard.showOverlay( "input\_name" ,{effect = "fade" , params ={levelNum = "level01"}, isModal = true} ) return true end

But i always get the same error: “storyboard.lua:1367: attempt to index upvalue ‘touchOverlay’ (a nil value)”

I’ve tried so much to get the overlay running but as i said, i always get this error.

And i dont find any solutions or other error reports for this error.

I hope someone can help me :slight_smile:

Hi @a.jaks,

Is this a new project you’re working on, or something you adopted from elsewhere? If it’s new, you really shouldn’t be using Storyboard since it’s been deprecated for ~2 years. Instead, you should use Composer which is current and will be maintained going forward (Storyboard will not be updated in any way).

Even if you adopted this code from elsewhere, I would recommend you convert it over to Composer (it’s actually not that difficult since the two share many fundamental similarities). Converting now will save you potential headaches in the future.

Best regards,

Brent

Hey Brent, 

i’m already working with composer. I was wondering why the composer dont had any showOverlay but you are right, i convertet the code from storyboard to composer and its working now! Thank you a lot, its so easy when you know this :smiley:

Now my code is and will stay storyboard free and clean :smiley:

Thanks again!

Composer supports Overlay’s much the same way Storyboard did.  There is a composer.showOverlay() API and a composer.hideOverlay(). The big difference is the new overlay system doesn’t generate show and hide events in the parent. Instead, when you’re ready to hide the overlay you can access the parent and execute code in the parent scene when hiding. It works quite well and is documented in the Composer guide.

https://docs.coronalabs.com/daily/guide/system/composer/index.html#accessing-the-parent-scene

Rob

Hi @a.jaks,

Is this a new project you’re working on, or something you adopted from elsewhere? If it’s new, you really shouldn’t be using Storyboard since it’s been deprecated for ~2 years. Instead, you should use Composer which is current and will be maintained going forward (Storyboard will not be updated in any way).

Even if you adopted this code from elsewhere, I would recommend you convert it over to Composer (it’s actually not that difficult since the two share many fundamental similarities). Converting now will save you potential headaches in the future.

Best regards,

Brent

Hey Brent, 

i’m already working with composer. I was wondering why the composer dont had any showOverlay but you are right, i convertet the code from storyboard to composer and its working now! Thank you a lot, its so easy when you know this :smiley:

Now my code is and will stay storyboard free and clean :smiley:

Thanks again!

Composer supports Overlay’s much the same way Storyboard did.  There is a composer.showOverlay() API and a composer.hideOverlay(). The big difference is the new overlay system doesn’t generate show and hide events in the parent. Instead, when you’re ready to hide the overlay you can access the parent and execute code in the parent scene when hiding. It works quite well and is documented in the Composer guide.

https://docs.coronalabs.com/daily/guide/system/composer/index.html#accessing-the-parent-scene

Rob