Difference between revisions of "Event.TIMER"

From GiderosMobile
 
Line 6: Line 6:
 
=== Description ===
 
=== Description ===
 
This event is dispatched on every Timer repeat until timer is stopped or the provided amount of repeat count is reached.
 
This event is dispatched on every Timer repeat until timer is stopped or the provided amount of repeat count is reached.
 +
 +
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
local timer = Timer.new(1000, 2) -- timer will execute 2 times with 1000ms delay
 +
timer:addEventListener(Event.TIMER, function()
 +
print("timer count: "..timer:getCurrentCount())
 +
end)
 +
timer:start()
 +
</syntaxhighlight>
  
 
{{Timer}}
 
{{Timer}}

Latest revision as of 01:45, 25 August 2024

Available since: Gideros 2011.6
Value: timer
Defined by: Timer

Description

This event is dispatched on every Timer repeat until timer is stopped or the provided amount of repeat count is reached.

Example

local timer = Timer.new(1000, 2) -- timer will execute 2 times with 1000ms delay
timer:addEventListener(Event.TIMER, function()
	print("timer count: "..timer:getCurrentCount())
end)
timer:start()