Read the comments about each of the Storyboard Scene Events.
Hope this helps
[lua]
–
– mainmenu.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– BEGINNING OF YOUR IMPLEMENTATION
– Called when the scene’s view does not exist:
function scene:createScene( event )
local screenGroup = self.view
– print( “\n1: createScene event”)
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
print( “1: enterScene event” )
– == If there was a previous screen like the help - totally remove it from memory
— But no longer needed if you set storyboard.purgeOnSceneChange = true
if storyboard.getPrevious() ~= nil then
--print("previous screen in mainmenu " … storyboard.getPrevious());
storyboard.purgeScene(storyboard.getPrevious())
storyboard.removeScene(storyboard.getPrevious())
end
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
print( “1: exitScene event” )
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
print( “((destroying scene 1’s view))” )
end
– Called BEFORE scene has moved onscreen:
– This event requires build 2012.782 or later.
function scene:willEnterScene( event )
local screenGroup = self.view
end
– Called AFTER scene has finished moving offscreen:
–This event requires build 2012.782 or later.
function scene:didExitScene( event )
local screenGroup = self.view
end
– Called if/when overlay scene is displayed via storyboard.showOverlay()
–This event requires build 2012.797 or later.
function scene:overlayBegan( event )
local screenGroup = self.view
local overlay_name = event.sceneName – name of the overlay scene
end
– Called if/when overlay scene is hidden/removed via storyboard.hideOverlay()
–This event requires build 2012.797 or later.
function scene:overlayEnded( event )
local screenGroup = self.view
local overlay_name = event.sceneName – name of the overlay scene
end
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “willEnterScene” event is dispatched before scene transition begins
scene:addEventListener( “willEnterScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “didExitScene” event is dispatched after scene has finished transitioning out
scene:addEventListener( “didExitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
– “overlayBegan” event is dispatched when an overlay scene is shown
scene:addEventListener( “overlayBegan”, scene )
– “overlayEnded” event is dispatched when an overlay scene is hidden/removed
scene:addEventListener( “overlayEnded”, scene )
return scene
[/lua]
Larry Meadows
DoubleSlashDesign.com / TinyTapApps.com