Corona sdk composer 不会回到之前的场景

Corona sdk composer wont got back to previous scene

我已经使用 coronaSDK composer 在我的应用程序中创建了场景。我有一个选项按钮,可以进入选项场景。但是,当我在选项场景上放置一个按钮以返回主菜单场景时,它不起作用

mainMenu.lua

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

-- "scene:create()"
function scene:create( event )

    local sceneGroup = self.view

    local backgroundimg = display.newImage("image/mainBackground.png")
    backgroundimg.x = display.contentWidth*0.5
    backgroundimg.y = display.contentHeight*0.5
    sceneGroup:insert( backgroundimg )

    local function startListener( event )
        composer.gotoScene( "scene.play" )
    end

    local start = display.newRect(65,99.5,161,161)
    start.alpha = 0.01
    start:addEventListener( "tap", startListener )

    local function leaderListener( event )
        composer.gotoScene( "scene.leaderboards" )
    end

    local leader = display.newRect(208,227.5,147,147)
    leader.alpha = 0.01
    leader:addEventListener( "tap", leaderListener )

    local function optionsListener( event )
        composer.gotoScene( "scene.options" )
    end

    local options = display.newRect(332,92.5,147,147)
    options.alpha = 0.01
    options:addEventListener( "tap", optionsListener )

    local function quitListener( event )
       os.exit()
    end

    local quit = display.newRect(432,240.5,120,120)
    quit.alpha = 0.01
    quit:addEventListener( "tap", quitListener )

end

-- "scene:show()"
function scene:show( event )

    local sceneGroup = self.view
    local phase = event.phase

    if ( phase == "will" ) then

    elseif ( phase == "did" ) then

    end
end

-- "scene:hide()"
function scene:hide( event )

    local sceneGroup = self.view
    local phase = event.phase

    if ( phase == "will" ) then

    elseif ( phase == "did" ) then

    end
end

-- "scene:destroy()"
function scene:destroy( event )

    local sceneGroup = self.view

end

scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )

return scene

options.lua

local composer = require( "composer" )

local scene = composer.newScene()

-- "scene:create()"
function scene:create( event )

    local sceneGroup = self.view

    local function startListener( event )
        composer.gotoScene( "scene.mainMenu" )
    end

    local start = display.newRect(65,99.5,161,161)
    start.alpha = 1
    start:addEventListener( "tap", startListener )
end

尝试使用:

composer.gotoScene( "mainMenu" )

此外,您没有将对象添加到场景组。因此,当场景发生变化时,对象不会自动移除。