A class for managing a group of timers.
protected var _children:Array
protected var _freeSlots:Array
protected var _parent:TimerManager
protected var _timers:Array
public function TimerManager(parent:TimerManager = null)
Constructs a new TimerManager.
Parameters
| parent:TimerManager (default = null) — (optional) if not null, this TimerManager will become a child of
the specified parent TimerManager. If the parent is shutdown, or its cancelAllTimers()
function is called, this TimerManager will be similarly affected.
|
public function cancelAllTimers():void
Stops all timers being managed by this TimerManager.
All child TimerManagers will have their timers stopped as well.
public function cancelTimer(timer:ManagedTimer):void
Cancels a single running ManagedTimer. The timer must have been created by this
TimerManager.
Parameters
public function createTimer(delay:Number, repeatCount:int, timerCallback:Function = null, completeCallback:Function = null):ManagedTimer
Creates, but doesn't run, a new ManagedTimer.
Parameters
| delay:Number |
| |
| repeatCount:int |
| |
| timerCallback:Function (default = null) |
| |
| completeCallback:Function (default = null) |
Returns
public function runForever(delay:Number, callback:Function):ManagedTimer
Creates and runs a timer that will run forever, or until canceled.
Parameters
| delay:Number |
| |
| callback:Function |
Returns
public function runOnce(delay:Number, callback:Function):void
Creates and runs a timer that will run once, and clean up after itself.
Parameters
| delay:Number |
| |
| callback:Function |
public function shutdown():void
Cancels all running timers, and disconnects the TimerManager from its parent, if it has one.
All child TimerManagers will be shutdown as well.
It's an error to call any function on TimerManager after shutdown() has been called.
protected function stopTimer(managedTimer:ManagedTimerImpl):voidParameters
| managedTimer:ManagedTimerImpl |