Ok so I am getting what i think is some wild Storyboard Behavior:
Step 1
Create a Main.lua, Sceen1.lua, Screen2.lua, Screen3.lua
Main.lua
[lua]
local function onSystemEvent( event )
local lastScene = storyboard.getPrevious() --Get the previous scene if there was one
if (lastScene ~= nil ) then print(lastScene) else print(“Last Scene was NIL - must be application Start - yea…”)
end
storyboard.gotoScene( " Screen1" ) – Navigate to the Screen1.lua
[/lua]
Screen1.lua
[lua]
function scene:createScene( event )
local screenGroup = self.view
– == If there was a previous screen like the help - totally remove it from memory
if storyboard.getPrevious() ~= nil then
--storyboard.removeScene(storyboard.getPrevious()) – NOTE I have Tried Both functions
storyboard.purgeScene(storyboard.getPrevious())
end
end
etc…
storyboard.gotoScene( " Screen2" ) – Navigate to the Screen2.lua
[/lua]
Screen2.lua
[lua]
function scene:createScene( event )
local screenGroup = self.view
– == If there was a previous screen like the help - totally remove it from memory
if storyboard.getPrevious() ~= nil then
--storyboard.removeScene(storyboard.getPrevious()) – NOTE I have Tried Both functions
storyboard.purgeScene(storyboard.getPrevious())
end
end
etc…
storyboard.gotoScene( " Screen3" ) – Navigate to the Screen3.lua
[/lua]
Screen3.lua
in screen3 – cause a - Hardware Suspend - to occur from the Simulator Menu -
Here is the actual problem
During when the - onSystemEvent - fires in the main.lua -
local lastScene = storyboard.getPrevious() --Get the previous scene…
When you look at the lastScene in the onSystemEvent it returns returns “Screen2”
But we were on Screen3 when the app was suspended, and the destroy was fired for Screen2 so I know it should be gone.
I wanted until the scene was created before suspending the app…
Any Clue why this would occur?
Screen3 should be returned not Screen2
I am trying to get the information for the last scene to save it to a file so I know where to reload and where the user left off at.
I could hard code a variable in each scene and set it to a Global variable in each scene but I would rather not.
If this is truly an error in Corona - i wont wait I’ll hard the values - but if not if someone could tell me what I am doing wrong that would be wonderful.
thanks in advance
Larry
thanks in advance.