我遇到了Android後退鍵的問題。 Corona論壇並沒有幫助我。無論我在哪個場景中,後退按鈕只會讓我回到主菜單,而不是像它應該的前一個場景。Corona SDK Android後退鍵導航
我的應用程序的地圖...
菜單>菜單2>教程>教程1
教程應該回到菜單2,教程1應該回到教程,但都回去菜單。
我在下面的所有場景中都有這個功能,用它們各自的「changeScene」返回到前一個屏幕;但正如我所提到的,所有人都將我帶回主菜單。
local function moveBack()
Runtime:removeEventListener("key", onKeyEvent)
display.remove(allObjects);allObjects=nil
director:changeScene("previousScene", "crossfade")
end
local function onKeyEvent(event)
local returnValue = true
if (event.phase=="up" and event.keyName=="back") then
timer.performWithDelay(100,moveBack,1)
end
return returnValue
end
Runtime:addEventListener("key", onKeyEvent)