In one of my storyboard scenes, I have a back button which allows you to go back to the previous scene. Here is the code I am using
local function onSceneTouch( self, event )
if event.phase == "began" then
local lastScene = storyboard.getPrevious()
print(lastScene)
storyboard.gotoScene( lastScene, "slideLeft", 1000 )
return true
end
end
local backBtn = display.newImage("back\_buttonGrey.png", 380, 10)
backBtn.touch = onSceneTouch
backBtn:addEventListener( "touch", backBtn)
When I try to press the back button I get this error:
Runtime error
?:0: attempt to index field 'contentBounds' (a nil value)
stack traceback:
[C]: ?
?: in function '?'
?: in function 'gotoScene'
...phil\documents\corona projects\stuck\_scenes\shop.lua:59: in function
<...phil projects>
I can not understand why this is not working, I have used code like this piece elsewhere in my app to allow a user to go back to the previous scene and it works [import]uid: 208811 topic_id: 36195 reply_id: 336195[/import] </…phil>