storyboard.gotoScene("facebook", "fade", 400)
不工作,如果我點擊按鈕,我沒有得到任何錯誤信息在終端。我究竟做錯了什麼 ?按鈕gotoScene不工作
-- 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
嗨羅布,當我嘗試這兩個選項我得到:運行時錯誤?:0:嘗試調用方法'dispatchEvent' – 2013-02-25 02:52:25