@Rob: When running storyboard.reloadScene(), only exitScene() and willEnterScene() are called. createScene() is never called. Is this a bug, or what am I doing wrong?
willExitScene: NO
exitScene: YES
createScene: NO
willEnterScene: YES
enterScene: NO
[lua]local scene = storyboard.newScene()
local fontSize = 20
function scene:createScene(event)
print(“createScene”)
local group = self.view
local function onRedraw(event)
if event.phase == “ended” then
fontSize = fontSize + 3
print(“fontSize:”, fontSize)
group = nil – documentation says createScene() is only called if scene’s view display group does not exist, so trying to nil it here (with no luck though)
storyboard.reloadScene()
end
return true
end
local text = display.newText(“Click to increase font size”, 0, 240, 320, 480, native.systemFont, fontSize)
text:addEventListener(“touch”, onRedraw)
group:insert(text)
end
function scene:willEnterScene(event)
print(“willEnterScene”)
end
function scene:enterScene(event)
print(“enterScene”)
end
function scene:willExitScene(event)
print(“willExitScene”)
end
function scene:exitScene(event)
print(“exitScene”)
storyboard.purgeScene()
end
scene:addEventListener(“createScene”, scene)
scene:addEventListener(“willEnterScene”, scene)
scene:addEventListener(“enterScene”, scene)
scene:addEventListener(“willExitScene”, scene)
scene:addEventListener(“exitScene”, scene)
return scene[/lua]
Update: The following technique seems to reload the scene successfully. Unless someone can come up with a way of making reloadScene() work, I’ll go for this one.
[lua]local group = scene.view
for i=group.numChildren, 1, -1 do
display.remove(group[i])
group[i] = nil
end
scene:createScene() [/lua]
[import]uid: 73434 topic_id: 34328 reply_id: 136692[/import]