Following the example
local storyboard = require “storyboard”
local scene = storyboard.newScene()
function scene:createScene( event )
– scene creation code goes here
end
scene:addEventListener( “createScene” )
function scene:enterScene( event )
– display scene overlay
local options =
{
effect = “fade”,
time = 400
}
storyboard.showOverlay( “overlay_scene”, options )
end
scene:addEventListener( “enterScene” )
– the following event is dispatched once the overlay is in place
function scene:overlayBegan( event )
print( "Showing overlay: " … event.sceneName )
end
scene:addEventListener( “overlayBegan” )
– the following event is dispatched once overlay is removed
function scene:overlayEnded( event )
print( "Overlay removed: " … event.sceneName )
end
scene:addEventListener( “overlayEnded” )
return scene
there is no reference to “overlay_scene” so how does it work.
My code would not allow that. this code did not work
local protectscene = storyboard.newScene( )
function protectscene:createScene(event)
local protectrectext= display.newRoundedRect( 5, 100, display.contentWidth-10,290,12 )
end
protectscene:addEventListener( “createScene” )
local protectbutton = widget.newButton( {id = “protectbutton”, left=5, top = 400, label = “Protection”, width= (display.contentWidth-20)/3, height=60, defaultColor={251, 170, 39}, onPress = storyboard.showOverlay( “protectscene” )} )
This code works sort of
local protectscene = storyboard.newScene( “protectscene” )
function protectscene:createScene(event)
local protectrectext= display.newRoundedRect( 5, 100, display.contentWidth-10,290,12 )
end
protectscene:addEventListener( “createScene” )
local protectbutton = widget.newButton( {id = “protectbutton”, left=5, top = 400, label = “Protection”, width= (display.contentWidth-20)/3, height=60, defaultColor={251, 170, 39}, onPress = storyboard.showOverlay( “protectscene” )} )
And now it overlays my existing screen on load I don’t even have to press the protect button.
Why does your example not reference the name and mine has to?
Why does it display before the button is even pressed?
[import]uid: 136344 topic_id: 30890 reply_id: 330890[/import]