Packagestarling.animation
Classpublic class DelayedCall
InheritanceDelayedCall Inheritance EventDispatcher Inheritance Object
Implements IAnimatable

A DelayedCall allows you to execute a method after a certain time has passed. Since it implements the IAnimatable interface, it can be added to a juggler. In most cases, you do not have to use this class directly; the juggler class contains a method to delay calls directly.

DelayedCall dispatches an Event of type 'Event.REMOVE_FROM_JUGGLER' when it is finished, so that the juggler automatically removes it when its no longer needed.

See also

Juggler


Public Properties
 PropertyDefined By
  arguments : Array
[read-only] The arguments that the callback will be executed with.
DelayedCall
  callback : Function
[read-only] The callback that will be executed when the time is up.
DelayedCall
  currentTime : Number
[read-only] The time that has already passed (in seconds).
DelayedCall
  isComplete : Boolean
[read-only] Indicates if enough time has passed, and the call has already been executed.
DelayedCall
  repeatCount : int
The number of times the call will be repeated.
DelayedCall
  totalTime : Number
[read-only] The time for which calls will be delayed (in seconds).
DelayedCall
Public Methods
 MethodDefined By
  
DelayedCall(callback:Function, delay:Number, args:Array = null)
Creates a delayed call.
DelayedCall
 Inherited
addEventListener(type:String, listener:Function):void
Registers an event listener at a certain object.
EventDispatcher
  
advanceTime(time:Number):void
Advance the time by a number of seconds.
DelayedCall
  
complete():void
Advances the delayed call so that it is executed right away.
DelayedCall
 Inherited
dispatchEvent(event:Event):void
Dispatches an event to all objects that have registered listeners for its type.
EventDispatcher
 Inherited
dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void
Dispatches an event with the given parameters to all objects that have registered listeners for the given type.
EventDispatcher
 Inherited
hasEventListener(type:String, listener:Function = null):Boolean
If called with one argument, figures out if there are any listeners registered for the given event type.
EventDispatcher
 Inherited
removeEventListener(type:String, listener:Function):void
Removes an event listener from the object.
EventDispatcher
 Inherited
removeEventListeners(type:String = null):void
Removes all event listeners with a certain type, or all of them if type is null.
EventDispatcher
  
reset(callback:Function, delay:Number, args:Array = null):DelayedCall
Resets the delayed call to its default values, which is useful for pooling.
DelayedCall
Property Detail
argumentsproperty
arguments:Array  [read-only]

The arguments that the callback will be executed with. Beware: not a copy, but the actual object!


Implementation
    public function get arguments():Array
callbackproperty 
callback:Function  [read-only]

The callback that will be executed when the time is up.


Implementation
    public function get callback():Function
currentTimeproperty 
currentTime:Number  [read-only]

The time that has already passed (in seconds).


Implementation
    public function get currentTime():Number
isCompleteproperty 
isComplete:Boolean  [read-only]

Indicates if enough time has passed, and the call has already been executed.


Implementation
    public function get isComplete():Boolean
repeatCountproperty 
repeatCount:int

The number of times the call will be repeated. Set to '0' to repeat indefinitely.

The default value is 1.


Implementation
    public function get repeatCount():int
    public function set repeatCount(value:int):void
totalTimeproperty 
totalTime:Number  [read-only]

The time for which calls will be delayed (in seconds).


Implementation
    public function get totalTime():Number
Constructor Detail
DelayedCall()Constructor
public function DelayedCall(callback:Function, delay:Number, args:Array = null)

Creates a delayed call.

Parameters
callback:Function
 
delay:Number
 
args:Array (default = null)
Method Detail
advanceTime()method
public function advanceTime(time:Number):void

Advance the time by a number of seconds.

Parameters

time:Number — in seconds.

complete()method 
public function complete():void

Advances the delayed call so that it is executed right away. If 'repeatCount' is anything else than '1', this method will complete only the current iteration.

reset()method 
public function reset(callback:Function, delay:Number, args:Array = null):DelayedCall

Resets the delayed call to its default values, which is useful for pooling.

Parameters

callback:Function
 
delay:Number
 
args:Array (default = null)

Returns
DelayedCall