Search code examples
luacoronasdkcorona-storyboard

Button gotoScene not working


the storyboard.gotoScene("facebook", "fade", 400) is not working if i tap the button, and i dont get any error messages in the terminal. What am i doing wrong ?

-- requires 
display.setStatusBar( display.HiddenStatusBar ) 
_W = display.contentWidth; --Returns Screen Width
_H = display.contentHeight; --Returns Screen Height


local storyboard = require ("storyboard")
local scene = storyboard.newScene()

-- background

function scene:createScene(event)

    local screenGroup = self.view
    background = display.newImage("restart.png")
    screenGroup:insert(background)

    button = display.newImage("share2.png") 
    button.x = display.contentWidth / 2
    button.y = display.contentHeight -400
end

  function listener(event) 
    if event.phase == "began" then
          print(event.name.." occurred") 
        storyboard.gotoScene("facebook", "fade", 400)
    end
end 

function scene:enterScene(event)
    storyboard.purgeScene("game")
    button:addEventListener( "tap", listener ) 
end

function scene:exitScene(event)
    button:removeEventListener( "tap", listener ) 
end

function scene:destroyScene(event)
end

scene:addEventListener("createScene", scene)
scene:addEventListener("enterScene", scene)
scene:addEventListener("exitScene", scene)
scene:addEventListener("destroyScene", scene)

return scene

Solution

  • It looks like corona does not like it when you call a Scene 'facebook' or renamed facebook to 'postmyscore' and it works