I can’t reproduce the bug in a small and simple program so it looks like I am causing the crash.
The crash didn’t have a stack trace, the simulator just crashed so it made it hard for me to find out what part of my code is wrong.
I thought it might be a corona issue because in my exitScene I called removeSelf on my button that caused the crash so I wasn’t sure what could still be triggering when releasing the button during the change scene. Trying the same thing in a small test program doesn’t crash the simulator so that’s good news for you
– main
local widget = require (“widget”)
local storyboard = require(“storyboard”)
storyboard:gotoScene(“scene1”)
–scene 1
local storyboard = require(“storyboard”)
local widget = require(“widget”)
local scene = storyboard.newScene()
local button = nil
function myManualEvent(event)
print(event.phase)
if event.phase == “ended” then
storyboard:gotoScene(“scene2”)
end
end
function automaticSceneChange()
print(“auto”)
storyboard:gotoScene(“scene2”)
end
function scene:enterScene( event )
print(“entered scene1”)
timer.performWithDelay(1000,automaticSceneChange,1)
button = widget.newButton
{
left = display.contentWidth / 2,
top = display.contentWidth / 2,
width = 100,
height = 50,
onPress = myManualEvent,
onRelease = myManualEvent,
label = “test”,
fontSize = 10,
}
end
function scene:exitScene( event )
print(“exited scene1”)
button:removeSelf()
end
scene:addEventListener( “enterScene”, scene )
scene:addEventListener(“exitScene”, scene)
return scene
– SCENE 2
local storyboard = require(“storyboard”)
local scene = storyboard.newScene()
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
print(“entered scene2”)
end
function scene:exitScene( event )
print(“exited scene2”)
end
scene:addEventListener( “enterScene”, scene )
scene:addEventListener(“exitScene”, scene)
return scene