hello,
i’m trying to test the showOverlay but i don’t know why is wrong.
I’m in scene1 and trying to overlay the scene2 and this is the
error message:
Runtime error
…cks\documents\corona projects\multiscreen\scene1.lua:23: attempt to c
all field ‘showOverlay’ (a nil value)
stack traceback:
[C]: in function ‘showOverlay’
…cks\documents\corona projects\multiscreen\scene1.lua:23: in function
<…cks …cks projects error:="">3: attempt to call field ‘showOverlay’ (a nil value)
stack traceback:
code:
---------------------scene1.lua<br>local storyboard = require( "storyboard" )<br>local scene = storyboard.newScene()<br>function scene:createScene( event )<br> local group = self.view<br><br> local myRect = display.newRect (100, 100, 100, 100)<br> myRect:setFillColor ( 100, 100, 100)<br> <br> <br>end<br>-- Called immediately after scene has moved onscreen:<br>function scene:enterScene( event )<br> local group = self.view<br> <br> local options =<br> {<br> effect = "fade",<br> time = 400,<br> }<br> storyboard.showOverlay( "scene2", options )<br> <br> <br>end<br>-- Called when scene is about to move offscreen:<br>function scene:exitScene( event )<br> local group = self.view<br> <br> <br>end<br>-- Called prior to the removal of scene's "view" (display group)<br>function scene:destroyScene( event )<br> local group = self.view<br> <br> <br>end<br>---------------------------------------------------------------------------------<br>-- END OF YOUR IMPLEMENTATION<br>---------------------------------------------------------------------------------<br><br>-- "createScene" event is dispatched if scene's view does not exist<br>scene:addEventListener( "createScene", scene )<br><br>-- "enterScene" event is dispatched whenever scene transition has finished<br>scene:addEventListener( "enterScene", scene )<br><br>-- "exitScene" event is dispatched before next scene's transition begins<br>scene:addEventListener( "exitScene", scene )<br><br>-- "destroyScene" event is dispatched before view is unloaded, which can be<br>-- automatically unloaded in low memory situations, or explicitly via a call to<br>-- storyboard.purgeScene() or storyboard.removeScene().<br>scene:addEventListener( "destroyScene", scene )<br><br>---------------------------------------------------------------------------------<br><br>return scene<br><br>
---------------------scene2.lua<br>local storyboard = require( "storyboard" )<br>local scene = storyboard.newScene()<br>function scene:createScene( event )<br> local group = self.view<br><br> local myCircle = display.newCircle( 100, 100, 30 )<br> myCircle:setFillColor(128,128,128)<br>end<br><br>function scene:enterScene( event )<br> local group = self.view<br><br>end<br>-- Called when scene is about to move offscreen:<br>function scene:exitScene( event )<br> local group = self.view<br> <br>end<br>-- Called prior to the removal of scene's "view" (display group)<br>function scene:destroyScene( event )<br> local group = self.view<br><br>end<br>---------------------------------------------------------------------------------<br>-- END OF YOUR IMPLEMENTATION<br>---------------------------------------------------------------------------------<br><br>-- "createScene" event is dispatched if scene's view does not exist<br>scene:addEventListener( "createScene", scene )<br><br>-- "enterScene" event is dispatched whenever scene transition has finished<br>scene:addEventListener( "enterScene", scene )<br><br>-- "exitScene" event is dispatched before next scene's transition begins<br>scene:addEventListener( "exitScene", scene )<br><br>-- "destroyScene" event is dispatched before view is unloaded, which can be<br>-- automatically unloaded in low memory situations, or explicitly via a call to<br>-- storyboard.purgeScene() or storyboard.removeScene().<br>scene:addEventListener( "destroyScene", scene )<br><br>---------------------------------------------------------------------------------<br><br>return scene<br>
Anyone know what i’m doing wrong?
Ps: sorry my bad english, is not my first language:
[import]uid: 162452 topic_id: 32698 reply_id: 332698[/import] </…cks>
What did you write on your main.lua file?
Try to put button and event listener on scene1.lua to go to the overlay scene (scene2.lua) .
[import]uid: 31508 topic_id: 32698 reply_id: 129980[/import]
i try put in a button but the message erros is the same
— main.lua
local storyboard = require “storyboard”
storyboard.gotoScene( “scene1” )
[import]uid: 162452 topic_id: 32698 reply_id: 129981[/import]
Add :
group:insert(myRect)
inside scene:createScene( event ) in scene1.lua
And try to use different effect like effect = “zoomInOutFade”
the code work when I tested it.
What build of corona sdk you using?
[import]uid: 31508 topic_id: 32698 reply_id: 129982[/import]
UPPS!! the build, I’M using an old build.
problem solved with thew new build
THANKS bpran. [import]uid: 162452 topic_id: 32698 reply_id: 129989[/import]
What did you write on your main.lua file?
Try to put button and event listener on scene1.lua to go to the overlay scene (scene2.lua) .
[import]uid: 31508 topic_id: 32698 reply_id: 129980[/import]
i try put in a button but the message erros is the same
— main.lua
local storyboard = require “storyboard”
storyboard.gotoScene( “scene1” )
[import]uid: 162452 topic_id: 32698 reply_id: 129981[/import]
Add :
group:insert(myRect)
inside scene:createScene( event ) in scene1.lua
And try to use different effect like effect = “zoomInOutFade”
the code work when I tested it.
What build of corona sdk you using?
[import]uid: 31508 topic_id: 32698 reply_id: 129982[/import]
UPPS!! the build, I’M using an old build.
problem solved with thew new build
THANKS bpran. [import]uid: 162452 topic_id: 32698 reply_id: 129989[/import]