event.time

类型 数字
事件 触摸
修订版本 版本 2024.3703
关键词 触摸,时间

概述

在触摸事件侦听器函数中,提供一种简单的方法来获取自应用程序启动以来经过的毫秒数。

示例

local object = display.newImage( "ball.png" )

function object:touch( event )
    if event.phase == "began" then
        print(event.time/1000 .. " seconds since app started." )
    end
    return true
end
object:addEventListener( "touch", object )