enterFrame

Type Event
Revision Release 2022.3683
Keywords enterFrame, runtime
See also Basic Interactivity and Event Detection (guide)

Overview

"enterFrame" events occur at the frames-per-second interval of the application, either 30 or 60 as specified in config.lua. They are only dispatched to the global Runtime object.

Properties

Examples

Event Name
local myListener = function( event )
    print( "Listener called with event of type " .. event.name )
end
Runtime:addEventListener( "enterFrame", myListener )
Event Frame
local function printCurrentFrameID( event )
    print ( "Current frame ID: " .. tostring(event.frame) )
end 
Runtime:addEventListener( "enterFrame", printCurrentFrameID )
Event Time
local function printTimeSinceStart( event )
    print ( tostring(event.time/1000) .. " seconds since app started." )
end 
Runtime:addEventListener( "enterFrame", printTimeSinceStart )