Hi,
I’m using the storyboard API and in my main I have a system event listener that loads my apps data, here a cut down version of the main.lua
[lua]
local function onSystemEvent( event )
print ("OnSystemEvent – event name = " … event.name … ", event type = " … event.type … " – Previous event type: " … tostring(previousEvent))
if “applicationExit” == event.type then
print(“exiting!!!”)
saveTable(storyboard.state.data, “data.json”)
elseif “applicationOpen” == event.type then
native.showAlert( “Open via custom url”, event.url, { “OK” } )
elseif “applicationStart” == event.type then
print(“loading data…”)
storyboard.state.data = loadTable(“data.json”)
– if there’s no file best build the table structure!
print(storyboard.state.data[1])
if (storyboard.state.data == nil) then
print(“no data found”)
storyboard.state.data = {}
end
else
– For all other events, check to see if file exist
end
return true
end
– Add the System callback event
Runtime:addEventListener( “system”, onSystemEvent );
print(storyboard.state.data[1])
– load first scene
storyboard.gotoScene( “listGuitar”, “fade”, 1 )
[/lua]
In my listGuitar.lua I have in the createScene a print line at the top
print("-- listGuitar : createScene")
However when I run the output is:
nil
– listGuitar : createScene
nil
OnSystemEvent – event name = system, event type = applicationStart – Previous event type: nil
loading data…
table: 0x10c007950
So the createScene in the listGuitar.lua is happening before the system event applicationStart!!!