Package | org.flixel |
Class | public class FlxTimer |
Inheritance | FlxTimer Object |
finished
flag.
Not intended to be added to a game state or group; the timer manager
is responsible for actually calling update(), not the user.
Property | Defined By | ||
---|---|---|---|
finished : Boolean
Check to see if the timer is finished. | FlxTimer | ||
loops : uint
How many loops the timer was set for. | FlxTimer | ||
loopsLeft : int [read-only]
Read-only: check how many loops are left on the timer. | FlxTimer | ||
manager : TimerManager [static] [read-only] | FlxTimer | ||
paused : Boolean
Pauses or checks the pause state of the timer. | FlxTimer | ||
progress : Number [read-only]
Read-only: how far along the timer is, on a scale of 0.0 to 1.0. | FlxTimer | ||
time : Number
How much time the timer was set for. | FlxTimer | ||
timeLeft : Number [read-only]
Read-only: check how much time is left on the timer. | FlxTimer |
Property | Defined By | ||
---|---|---|---|
_callback : Function
Internal tracker for the time's-up callback function. | FlxTimer | ||
_loopsCounter : uint
Internal tracker for the loops counting up. | FlxTimer | ||
_timeCounter : Number
Internal tracker for the actual timer counting up. | FlxTimer |
Method | Defined By | ||
---|---|---|---|
FlxTimer()
Instantiate the timer. | FlxTimer | ||
destroy():void
Clean up memory. | FlxTimer | ||
Starts or resumes the timer. | FlxTimer | ||
stop():void
Stops the timer and removes it from the timer manager. | FlxTimer | ||
update():void
Called by the timer manager plugin to update the timer. | FlxTimer |
_callback | property |
protected var _callback:Function
Internal tracker for the time's-up callback function. Callback should be formed "onTimer(Timer:FlxTimer);"
_loopsCounter | property |
protected var _loopsCounter:uint
Internal tracker for the loops counting up.
_timeCounter | property |
protected var _timeCounter:Number
Internal tracker for the actual timer counting up.
finished | property |
public var finished:Boolean
Check to see if the timer is finished.
loops | property |
public var loops:uint
How many loops the timer was set for.
loopsLeft | property |
loopsLeft:int
[read-only] Read-only: check how many loops are left on the timer.
public function get loopsLeft():int
manager | property |
paused | property |
public var paused:Boolean
Pauses or checks the pause state of the timer.
progress | property |
progress:Number
[read-only] Read-only: how far along the timer is, on a scale of 0.0 to 1.0.
public function get progress():Number
time | property |
public var time:Number
How much time the timer was set for.
timeLeft | property |
timeLeft:Number
[read-only] Read-only: check how much time is left on the timer.
public function get timeLeft():Number
FlxTimer | () | Constructor |
public function FlxTimer()
Instantiate the timer. Does not set or start the timer.
destroy | () | method |
public function destroy():void
Clean up memory.
start | () | method |
public function start(Time:Number = 1, Loops:uint = 1, Callback:Function = null):FlxTimer
Starts or resumes the timer. If this timer was paused, then all the parameters are ignored, and the timer is resumed. Adds the timer to the timer manager.
Parameters
Time:Number (default = 1 ) — How many seconds it takes for the timer to go off.
| |
Loops:uint (default = 1 ) — How many times the timer should go off. Default is 1, or "just count down once."
| |
Callback:Function (default = null ) — Optional, triggered whenever the time runs out, once for each loop. Callback should be formed "onTimer(Timer:FlxTimer);"
|
FlxTimer — A reference to itself (handy for chaining or whatever).
|
stop | () | method |
public function stop():void
Stops the timer and removes it from the timer manager.
update | () | method |
public function update():void
Called by the timer manager plugin to update the timer.
If time runs out, the loop counter is advanced, the timer reset, and the callback called if it exists.
If the timer runs out of loops, then the timer calls stop()
.
However, callbacks are called AFTER stop()
is called.