| Package | org.goasap.utils |
| Class | public class SequenceBase |
| Inheritance | SequenceBase PlayableBase flash.events.EventDispatcher |
| Implements | IPlayable |
| Subclasses | Sequence, SequenceCA |
When subclassing, follow the instructions in the comments of the protected methods to add a standard set of public getters and methods that work with the specific datatype of your SequenceStep subclass, if you create one. (This system is designed to work around the restrictiveness of overrides in AS3 which don't allow you to redefine datatypes.) See Sequence and SequenceCA for examples.
See also
| Property | Defined by | ||
|---|---|---|---|
| length : int [read-only]
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 [read-only]
The current play index of the sequence, starting a 0.
| SequenceBase | ||
| repeater : Repeater
[read-only]
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 | ||
|---|---|---|---|
|
SequenceBase(... items)
Constructor.
| SequenceBase | ||
|
pause():Boolean
Pauses sequence play.
| SequenceBase | ||
|
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 | |
| Method | Defined by | ||
|---|---|---|---|
|
Developers: Add a method called
addStep to your subclass as in Sequence. | SequenceBase | ||
|
_addStepAt(index:int, item:IPlayable, stepTypeAsClass:* = null):int
Developers: Add a method called
addStep to your subclass as in Sequence. | SequenceBase | ||
|
_getCurrentStep():*
Developers: Add a getter called
currentStep to your subclass as in Sequence. | SequenceBase | ||
|
_getLastStep():*
Developers: Add a getter called
lastStep to your subclass as in Sequence. | SequenceBase | ||
|
_getStepAt(index:int):*
Developers: Add a method called
getStepAt to your subclass as in Sequence. | SequenceBase | ||
|
_getStepByID(playableID:*):*
Developers: Add a method called
getStepByID to your subclass as in Sequence. | SequenceBase | ||
|
_removeStepAt(index:int):*
Developers: Add a method called
addStep to your subclass as in Sequence. | SequenceBase | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when the sequence advances to its next step. | SequenceBase | |||
| Dispatched when the sequence successfully finishes. | SequenceBase | |||
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 | |||
| Dispatched when the sequence is paused successfully. | SequenceBase | |||
| Dispatched when the sequence is resumed successfully. | SequenceBase | |||
| Dispatched when the sequence starts. | SequenceBase | |||
| Dispatched when the sequence is manually stopped, which may also occur if one of its step instances is manually stopped outside the sequence. | SequenceBase | |||
| length | property |
length:int [read-only]The number of steps in the sequence.
Implementation public function get length():int
| playIndex | property |
playIndex:int [read-only]The current play index of the sequence, starting a 0.
Implementation public function get playIndex():int
| repeater | property |
repeater:Repeater [read-only]The sequence's Repeater instance, which may be used to make the sequence loop and play more than one time.
The Repeater's cycles property can be set to an integer, or to Repeater.INFINITE or 0 to repeat indefinitely.
var seq:Sequence = new Sequence(tween1, tween2, tween3); seq.repeater.cycles = 2; seq.start(); trace(seq.repeater.currentCycle); // output: 0 seq.skipTo(4); // moves to 2nd action in 2nd cycle trace(seq.repeater.currentCycle); // output: 1
(The repeater property replaces the repeatCount and currentCount parameters in earlier releases of SequenceBase).
Implementation public function get repeater():Repeater
| steps | property |
steps:Array [read-write]Get or set the list of SequenceStep instances that defines the sequence.
When setting this property, each item must implement IPlayable that uses PlayState constants and dispatches STOP or COMPLETE when finished. Each item is automatically wrapped in a SequenceStep if it is of any other IPlayable type, such as a GoItem or PlayableGroup. Setting this property stops any sequence play currently in progress.
Implementation public function get steps():Array
public function set steps(value:Array):void
See also
| SequenceBase | () | constructor |
public function SequenceBase(... 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 |
protected function _addStep(item:IPlayable, addToLastStep:Boolean = false, stepTypeAsClass:* = null):int
Developers: Add a method called addStep to your subclass as in Sequence.
Drop the third parameter in your subclass' addStep method. Use it to be sure the correct type of wrapper is created, as in SequenceCA.
Parametersitem:IPlayable — The playable item to add to the sequence.
|
|
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.
|
|
stepTypeAsClass:* (default = null) — Type for SequenceSteps. (Do not include this parameter in subclass addStep method.)
|
int — New length of the steps array.
|
| _addStepAt | () | method |
protected function _addStepAt(index:int, item:IPlayable, stepTypeAsClass:* = null):int
Developers: Add a method called addStep to your subclass as in Sequence.
Drop the third parameter in your subclass' addStep method. Use it to be sure the correct type of wrapper is created, as in SequenceCA.
Parametersindex:int — Position in the array starting at 0, or a negative
index like Array.splice.
|
|
item:IPlayable — The playable item to splice into the sequence.
|
|
stepTypeAsClass:* (default = null) — Type for SequenceSteps. (Do not include this parameter in subclass addStep method.)
|
int — New length of the steps array.
|
| _getCurrentStep | () | method |
protected function _getCurrentStep():*
Developers: Add a getter called currentStep to your subclass as in Sequence.
* — Developers: return the correct SequenceStep type for your subclass in your corresponding public method.
|
| _getLastStep | () | method |
protected function _getLastStep():*
Developers: Add a getter called lastStep to your subclass as in Sequence.
* — Developers: return the correct SequenceStep type for your subclass in your corresponding public method.
|
| _getStepAt | () | method |
protected function _getStepAt(index:int):*
Developers: Add a method called getStepAt to your subclass as in Sequence.
index:int — An array index starting at 0.
|
* — Developers: return the correct SequenceStep type for your subclass in your corresponding public method.
|
| _getStepByID | () | method |
protected function _getStepByID(playableID:*):*
Developers: Add a method called getStepByID to your subclass as in Sequence.
playableID:* — The step instance's playableID to search for.
|
* — Developers: return the correct SequenceStep type for your subclass in your corresponding public method.
|
| _removeStepAt | () | method |
protected function _removeStepAt(index:int):*
Developers: Add a method called addStep to your subclass as in Sequence.
index:int — Position in the array starting at 0, or a negative
index like Array.splice.
|
* — Developers: return the correct SequenceStep type for your subclass in your corresponding public method.
|
| pause | () | method |
public function pause():BooleanPauses sequence play.
ReturnsBoolean — Returns true unless sequence was unable to pause any children.
|
| resume | () | method |
public function resume():BooleanResumes previously-paused sequence play.
ReturnsBoolean — Returns true unless sequence was unable to resume any children.
|
| skipTo | () | method |
public function skipTo(index:Number):BooleanStops the current step and skips to another step by sequence index.
Parametersindex:Number |
Boolean — Always returns true since the index is normalized to the sequence.
|
| start | () | method |
public function start():BooleanBegins a sequence.
If the group is active when this method is called, a stop call
is automated which will result in a GoEvent.STOP event being dispatched.
Boolean — Returns true unless there are no steps in the sequence.
|
| stop | () | method |
public function stop():BooleanStops all activity and dispatches a GoEvent.STOP event.
ReturnsBoolean — Returns true unless sequence was already stopped.
|
| ADVANCE | event |
org.goasap.events.SequenceEvent
org.goasap.events.SequenceEvent.ADVANCE
Dispatched when the sequence advances to its next step.
| COMPLETE | event |
org.goasap.events.GoEvent
Dispatched when the sequence successfully finishes. (In SequenceCA this event is not fired until all custom-advanced steps have dispatched STOP or COMPLETE.)
| CYCLE | event |
org.goasap.events.GoEvent
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.
| PAUSE | event |
| RESUME | event |
| START | event |
| STOP | event |
org.goasap.events.GoEvent
Dispatched when the sequence is manually stopped, which may also occur if one of its step instances is manually stopped outside the sequence.