Access keys

Chain

Kind of class: class
Inherits from: EventDispatcher < CoreObject
Implements:
Known subclasses:
Version: 01/30/07
Author: Aaron Clinger
Classpath: org.casaframework.time.Chain
File last modified: Tuesday, 30 January 2007, 13:45:33
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
Instance properties
Instance properties inherited from EventDispatcher
Instance properties 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 destroy() before deleting last object pointer.
#

removeTask

function removeTask (
scope:Object, methodName:String) : Void
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".

resume

function resume (
) : Void
Resumes sequence from stopped position or restarts the sequence from the beginning.
Events broadcast to listeners:
onResume = function (sender:Chain) {}

start

function start (
) : Void
Starts the sequence from the beginning.
Events broadcast to listeners:
onStart = function (sender:Chain) {}

stop

function stop (
) : Void
Stops the sequence at its current position.
Events broadcast to listeners:
onStop = function (sender:Chain) {}