在Corona SDK中,通过点击按钮使Overlar显示出来

我用 Corona SDK 创建了一个弹出式查看器覆盖层,而不是传统的 composer.showOverlay(下面是代码)。我在覆盖层中添加了三个按钮,如下所示。但是,只有第一个输入的按钮会出现。有什么建议吗?

-- 通过暂停按钮执行覆盖层
pausedPopup = function()

    local group = display.newGroup()
    local back = display.newRoundedRect( group, 0, 0, 200, 150, 12 )
    back:setFillColor( 255/255, 255/255, 255/255 )
    back.x = centerX
    back.y = centerY

    local messages = {}
    messages[#messages+1] = "已暂停"

    local tmp = display.newText( group, messages[ math.random( 1, #messages )], 0, 0, gameFont,44 )
    tmp:setFillColor( 109/255, 182/255, 224/255 )
    tmp.x = back.x
    tmp.y = back.y -30

    local MenuLevels = widget.newButton({
        id = "MenuLevels",
        width = 100,
        height = 100,
         defaultFile = "MenuLevels.png",
        onEvent = handleMenuLevelsEvent
    })
    MenuLevels.x = centerX
    MenuLevels.y = centerY +40
    sceneGroup:insert( MenuLevels )

    local MenuPlay = widget.newButton({
        id = "MenuPlay",
        width = 100,
        height = 100,
         defaultFile = "MenuPlay.png",
        onEvent = handleMenuPlayEvent
    })
    MenuPlay.x = centerX -90
    MenuPlay.y = centerY +40
    sceneGroup:insert( MenuPlay )

    local MenuReset = widget.newButton({
        id = "MenuReset",
        width = 100,
        height = 100,
         defaultFile = "MenuReset.png",
        onEvent = handleMenuResetEvent
    })
    MenuReset.x = centerX +90
    MenuReset.y = centerY +40
    sceneGroup:insert( MenuReset )

    transition.to( group, { alpha = 0, time = 1000, delay = 5500 } )
    timer.performWithDelay( 6600, function() group:removeSelf() end )
end
点赞