Chain
| Kind of class: | class |
|---|---|
| Inherits from: | EventDispatcher < CoreObject |
| Implements: | |
| Known subclasses: | |
| Version: | 03/16/07 |
| Author: | Aaron Clinger |
| Classpath: | org.casaframework.time.Chain |
| File last modified: | Friday, 30 March 2007, 10:51:11 |
Creates a chain of sequenced methods calls that wait for a specified event before continuing.
Example:
var boxMoveRight:PropertyTween = new PropertyTween(this.box_mc, "_x", com.robertpenner.easing.Bounce.easeOut, 400, 1.5); var boxMoveLeft:PropertyTween = new PropertyTween(this.box_mc, "_x", com.robertpenner.easing.Bounce.easeOut, 0, 1.5); var chain:Chain = new Chain(true); chain.addTask(this.boxMoveRight, "start", Tween.EVENT_COMPLETE); chain.addTask(this.boxMoveLeft, "start", Tween.EVENT_COMPLETE); chain.start();
Events broadcast to listeners:
onStart = function (sender:Chain) {} onStop = function (sender:Chain) {} onResume = function (sender:Chain) {} onComplete = function (sender:Chain) {} onLoop = function (sender:Chain) {} Summary
Constructor
Class properties
Instance properties
Instance properties inherited from EventDispatcher
Instance properties inherited from CoreObject
Instance methods
Instance methods inherited from EventDispatcher
Instance methods inherited from CoreObject
Constructor
Chain
function Chain (
isLooping:Boolean)
Creates a new chain.
Parameters:
isLooping:
[optional] Indicates the sequence replays once completed
true, or stops false; defaults to false.Class properties
EVENT_COMPLETE
static EVENT_COMPLETE:String = 'onComplete'
(read,write)
EVENT_LOOP
static EVENT_LOOP:String = 'onLoop'
(read,write)
EVENT_RESUME
static EVENT_RESUME:String = 'onResume'
(read,write)
EVENT_START
static EVENT_START:String = 'onStart'
(read,write)
EVENT_STOP
static EVENT_STOP:String = 'onStop'
(read,write)
Instance methods
addTask
function addTask (
scope:DispatchableInterface,
startMethodName:String,
completeEventName:String,
delay:Number,
position:Number) : Void
Adds a task to the sequence.
Parameters:
scope :
An object that contains the method specified by "startMethodName" and that will dispatch "completeEventName" using org.casaframework.event.EventDispatcher.
startMethodName :
A method that exists in the scope of the object specified by "scope".
completeEventName:
The event the class waits to receive before continuing.
delay :
The time in milliseconds between when the complete event was recieved until the next start method will be called.
position :
[optional] Specifies the index of the insertion in the sequence order; defaults to the next position.
destroy
function destroy (
) : Void
Removes any internal variables, intervals, enter frames, internal MovieClips and event observers to allow the object to be garbage collected.
Always call
#Always call
destroy() before deleting last object pointer.Specified by:
removeTask
function removeTask (
scope:Object,
methodName:String) : Boolean
Removes task from the sequence.
Parameters:
scope :
An object that contains the method specified by "methodName".
methodName:
A method that exists in the scope of the object specified by "scope".
Returns:
Returns
true if task was successfully found and removed; otherwise false.resume
function resume (
) : Void
Resumes sequence from stopped position or restarts the sequence from the beginning.
Events broadcast to listeners:
onResume = function (sender:Chain) {} Specified by:
start
function start (
) : Void
Starts the sequence from the beginning.
Events broadcast to listeners:
onStart = function (sender:Chain) {} Specified by:
stop
function stop (
) : Void
Stops the sequence at its current position.
Events broadcast to listeners:
onStop = function (sender:Chain) {} Specified by: