| Package | org.goasap.utils |
| Class | public class Sequence |
| Inheritance | Sequence SequenceBase PlayableBase flash.events.EventDispatcher |
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
| Property | Defined by | ||
|---|---|---|---|
| currentStep : SequenceStep
[read-only]
Returns the currently-playing SequenceStep.
| Sequence | ||
| lastStep : SequenceStep
[read-only]
Returns the final SequenceStep in the current sequence.
| Sequence | ||
![]() | length : int
The number of steps in the sequence.
| SequenceBase | |
![]() | playableID : *
An arbitrary id value for the convenient identification of any
instance, automatically set to an instance count by this class.
| PlayableBase | |
![]() | playIndex : int
The current play index of the sequence, starting a 0.
| SequenceBase | |
![]() | repeater : Repeater
The sequence's Repeater instance, which may be used to make
the sequence loop and play more than one time.
| SequenceBase | |
![]() | state : String
Returns a PlayStates constant.
| PlayableBase | |
![]() | steps : Array
Get or set the list of SequenceStep instances that defines the sequence.
| SequenceBase | |
| Method | Defined by | ||
|---|---|---|---|
|
Sequence(... items)
Constructor.
| Sequence | ||
|
Adds a single IPlayable instance (e.g.
| Sequence | ||
|
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 | ||
![]() |
pause():Boolean
Pauses sequence play.
| SequenceBase | |
|
removeStepAt(index:int):SequenceStep
Removes and returns the SequenceStep at a specific index from the steps
array.
| Sequence | ||
![]() |
resume():Boolean
Resumes previously-paused sequence play.
| SequenceBase | |
![]() |
skipTo(index:Number):Boolean
Stops the current step and skips to another step by sequence index.
| SequenceBase | |
![]() |
start():Boolean
Begins a sequence.
| SequenceBase | |
![]() |
stop():Boolean
Stops all activity and dispatches a GoEvent.STOP event.
| SequenceBase | |
![]() |
toString():String
Appends the regular toString value with the instance's playableID.
| PlayableBase | |
| currentStep | property |
currentStep:SequenceStep [read-only]Returns the currently-playing SequenceStep.
Implementation public function get currentStep():SequenceStep
See also
| lastStep | property |
lastStep:SequenceStep [read-only]Returns the final SequenceStep in the current sequence.
Implementation public function get lastStep():SequenceStep
See also
| 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.
|
| addStep | () | method |
public function addStep(item:IPlayable, addToLastStep:Boolean = false):intAdds 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.
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.
|
int — New length of the steps array.
|
| addStepAt | () | method |
public function addStepAt(item:IPlayable, index:int):intAdds 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.
Parametersitem: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.
|
int — New length of the steps array.
|
| getStepAt | () | method |
public function getStepAt(index:int):SequenceStepRetrieves any SequenceStep from the steps array.
Parametersindex:int — An array index starting at 0.
|
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.
playableID:* — The step instance's playableID to search for.
|
SequenceStep —
The SequenceStep with the matching playableID.
|
See also
| removeStepAt | () | method |
public function removeStepAt(index:int):SequenceStepRemoves and returns the SequenceStep at a specific index from the steps array. Calling this method stops any sequence play currently in progress.
Parametersindex:int — Position in the array starting at 0, or a negative
index like Array.splice.
|
SequenceStep —
The SequenceStep instance removed from the steps array.
|