I've got this problem that is delaying my game by a milestone, in scene1 I click the menu button that takes me to the menu then when the user wants to play again they click the play button and they should go to the previous scene however when it does its goes to a black screen. here is some code, this is the main menu button in scene 1:
function scene:enterScene(event)
local group = self.view
function menubutton:touch( event )
if event.phase == "began" then
storyboard.gotoScene( "menu", "slideRight", 750 )
audio.play(click)
display.getCurrentStage():setFocus( event.target )
event.target.isFocus = true
elseif event.target.isFocus then
if event.phase == "moved" then
print( "user has moved their finger off the button." )
elseif event.phase == "ended" then
print( "user has switched to the main menu" )
display.getCurrentStage():setFocus( nil )
event.target.isFocus = false
end
end
return true
end
here is the play button on the main menu:
function scene:enterScene(event)
local group = self.view
local function onSceneTouch( event )
if event.phase == "ended" then
audio.play(click)
local previousScene = storyboard.getPrevious()
if previousScene == nil then
storyboard.gotoScene( "scene1", "slideLeft", 750 ) else
storyboard.gotoScene(previousScene)
return true
end
end
end
any ideas? I am getting NO errors in the simulator output.
Edit: This line of code stopped the blank screen when i placed it on the menu, but only the images show up, background image button images etc but nothing else.
local prior_scene = storyboard.getPrevious()
storyboard.purgeScene( prior_scene )