Packageorg.goasap.utils
Classpublic class Sequence
InheritanceSequence Inheritance SequenceBase Inheritance PlayableBase Inheritance flash.events.EventDispatcher

Simple playable sequence, composed of groups of playable items.

A sequence can be built by passing any item that implements IPlayable and uses the standard set of PlayState constants. Sequences are composed of SequenceStep instances, which can contain any number of child items such as LinearGo or PlayableGroup instances. Sequences dispatch SequenceEvent.ADVANCE each time a step completes and the play index advances to the next one, then GoEvent.COMPLETE when done.

Other events dispatched include the GoEvent types START, STOP, PAUSE, RESUME, and CYCLE if the repeater.cycles property is set to a value other than one.

All items in each step must dispatch COMPLETE or STOP before a Sequence will advance. This simple behavior can be limiting, especially with steps that are composed of groups of items. The Go utility package includes another sequencer called SequenceCA, which allows you to define different ways a sequence can advance: after a particular item in a step, a particular duration, after an event fires, etc.

See also

SequenceBase
SequenceCA


Public Properties
 PropertyDefined by
  currentStep : SequenceStep
[read-only] Returns the currently-playing SequenceStep.
Sequence
  lastStep : SequenceStep
[read-only] Returns the final SequenceStep in the current sequence.
Sequence
 Inheritedlength : int
The number of steps in the sequence.
SequenceBase
 InheritedplayableID : *
An arbitrary id value for the convenient identification of any instance, automatically set to an instance count by this class.
PlayableBase
 InheritedplayIndex : int
The current play index of the sequence, starting a 0.
SequenceBase
 Inheritedrepeater : Repeater
The sequence's Repeater instance, which may be used to make the sequence loop and play more than one time.
SequenceBase
 Inheritedstate : String
Returns a PlayStates constant.
PlayableBase
 Inheritedsteps : Array
Get or set the list of SequenceStep instances that defines the sequence.
SequenceBase
Protected Properties
 PropertyDefined by
 Inherited_playRetainer : Dictionary
[static] Memory-management: playable items that do not add themselves to GoEngine should use this property to store references to themselves during play.
PlayableBase
Public Methods
 MethodDefined by
  
Sequence(... items)
Constructor.
Sequence
  
addStep(item:IPlayable, addToLastStep:Boolean = false):int
Adds a single IPlayable instance (e.g.
Sequence
  
addStepAt(item:IPlayable, index:int):int
Adds a single IPlayable instance (e.g.
Sequence
  
getStepAt(index:int):SequenceStep
Retrieves any SequenceStep from the steps array.
Sequence
  
getStepByID(playableID:*):SequenceStep
Locates a step with the specified playableID.
Sequence
 Inherited
pause():Boolean
Pauses sequence play.
SequenceBase
  
Removes and returns the SequenceStep at a specific index from the steps array.
Sequence
 Inherited
resume():Boolean
Resumes previously-paused sequence play.
SequenceBase
 Inherited
skipTo(index:Number):Boolean
Stops the current step and skips to another step by sequence index.
SequenceBase
 Inherited
start():Boolean
Begins a sequence.
SequenceBase
 Inherited
stop():Boolean
Stops all activity and dispatches a GoEvent.STOP event.
SequenceBase
 Inherited
toString():String
Appends the regular toString value with the instance's playableID.
PlayableBase
Protected Methods
 MethodDefined by
 Inherited
_addStep(item:IPlayable, addToLastStep:Boolean = false, stepTypeAsClass:* = null):int
Developers: Add a method called addStep to your subclass as in Sequence.
SequenceBase
 Inherited
_addStepAt(index:int, item:IPlayable, stepTypeAsClass:* = null):int
Developers: Add a method called addStep to your subclass as in Sequence.
SequenceBase
 Inherited
Developers: Add a getter called currentStep to your subclass as in Sequence.
SequenceBase
 Inherited
Developers: Add a getter called lastStep to your subclass as in Sequence.
SequenceBase
 Inherited
_getStepAt(index:int):*
Developers: Add a method called getStepAt to your subclass as in Sequence.
SequenceBase
 Inherited
_getStepByID(playableID:*):*
Developers: Add a method called getStepByID to your subclass as in Sequence.
SequenceBase
 Inherited
_removeStepAt(index:int):*
Developers: Add a method called addStep to your subclass as in Sequence.
SequenceBase
Events
 EventSummaryDefined by
 Inherited Dispatched when the sequence advances to its next step.SequenceBase
 Inherited Dispatched when the sequence successfully finishes.SequenceBase
 Inherited Dispatched at the end the group if repeater.cycles is set to a value other than one, just before the sequence starts its next play cycle.SequenceBase
 Inherited Dispatched when the sequence is paused successfully.SequenceBase
 Inherited Dispatched when the sequence is resumed successfully.SequenceBase
 Inherited Dispatched when the sequence starts.SequenceBase
 Inherited Dispatched when the sequence is manually stopped, which may also occur if one of its step instances is manually stopped outside the sequence.SequenceBase
Property detail
currentStepproperty
currentStep:SequenceStep  [read-only]

Returns the currently-playing SequenceStep.

Implementation
    public function get currentStep():SequenceStep

See also

lastStepproperty 
lastStep:SequenceStep  [read-only]

Returns the final SequenceStep in the current sequence.

Implementation
    public function get lastStep():SequenceStep

See also

Constructor detail
Sequence()constructor
public function Sequence(... items)

Constructor.

Parameters
... items — Any number of IPlayable instances (e.g. LinearGo, PlayableGroup, SequenceStep) as separate arguments, or a single array of them.
Method detail
addStep()method
public function addStep(item:IPlayable, addToLastStep:Boolean = false):int

Adds a single IPlayable instance (e.g. LinearGo, PlayableGroup, SequenceStep) to the end of the steps array, or optionally adds the instance into the last SequenceStep instead of adding it as a new step.

To remove a step use the removeStepAt method.

Parameters
item:IPlayable — The playable item to add to the sequence. Note that when new steps are added, any IPlayable instance of a type other than SequenceStep is automatically wrapped in a new SequenceStep.
 
addToLastStep:Boolean (default = false) — If true is passed the item is added to the last existing SequenceStep in the steps array. This option should be used with individual items that you want added as children to the SequenceStep. If there are no steps yet this option ignored and a new step is created.

Returns
int — New length of the steps array.
addStepAt()method 
public function addStepAt(item:IPlayable, index:int):int

Adds a single IPlayable instance (e.g. LinearGo, PlayableGroup, SequenceStep) at a specific index in the steps array. Calling this method stops any sequence play currently in progress.

Parameters
item:IPlayable — The playable item to splice into the sequence.
 
index:int — Position in the array starting at 0, or a negative index like Array.splice.

Returns
int — New length of the steps array.
getStepAt()method 
public function getStepAt(index:int):SequenceStep

Retrieves any SequenceStep from the steps array.

Parameters
index:int — An array index starting at 0.

Returns
SequenceStep — The SequenceStep instance at this index.

See also

getStepByID()method 
public function getStepByID(playableID:*):SequenceStep

Locates a step with the specified playableID. To search within a step for a child by playableID, use the step instance's getChildByID method.

Parameters
playableID:* — The step instance's playableID to search for.

Returns
SequenceStep — The SequenceStep with the matching playableID.

See also

removeStepAt()method 
public function removeStepAt(index:int):SequenceStep

Removes and returns the SequenceStep at a specific index from the steps array. Calling this method stops any sequence play currently in progress.

Parameters
index:int — Position in the array starting at 0, or a negative index like Array.splice.

Returns
SequenceStep — The SequenceStep instance removed from the steps array.