【问题标题】:Corona image change scene when touch触摸时电晕图像变化场景
【发布时间】:2017-01-16 20:48:05
【问题描述】:

我有很多图片,我正在尝试点击图片显示详细信息(当触摸图片显示带有详细信息和一些图片历史的弹出窗口时,我正在寻找弹出教程)我没有找到什么所以我有了这个想法(打开新场景),但我不知道怎么做。

我有这个:

local archers = display.newImageRect( "cards/archers.png", 50, 50 )
archers.x = 30
archers.y = -18

我试过这个:

local function Archercall( event )
composer.gotoScene( "Archer" )
end

local archers = display.newImageRect( "cards/archers.png", 50, 50, onPress=Archercall )
archers.x = 30
archers.y = -18

但它给了我一个错误,如果可能的话需要在单击图像时弹出集成或单击图像时如何打开场景。

我认为弹出式方法会更干净更好。

谢谢。

【问题讨论】:

标签: android image lua popup coronasdk


【解决方案1】:

要打开场景,请尝试:

local function onObjectTouch( event )
    if ( event.phase == "began" ) then
        composer.gotoScene( "Archer" )
    end
    return true
end
archers:addEventListener( "touch", onObjectTouch )

阅读更多: https://docs.coronalabs.com/api/event/touch/index.html

弹出菜单: 在这个线程中 https://forums.coronalabs.com/topic/62108-implementing-ui-based-on-ios-7-google-material/ 通过许多示例链接到 git(查看 menu.lua-> 打开对话框)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-17
    • 2013-05-04
    • 1970-01-01
    相关资源
    最近更新 更多