Packageorg.goasap.utils
Classpublic class SequenceBase
InheritanceSequenceBase Inheritance PlayableBase Inheritance flash.events.EventDispatcher
ImplementsIPlayable
SubclassesSequence, SequenceCA

This base class should not be used directly, use it to build sequencing classes.

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

Sequence
SequenceCA


Public Properties
 PropertyDefined by
  length : int
[read-only] 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
  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
 Inheritedstate : String
Returns a PlayStates constant.
PlayableBase
  steps : 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
  
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
 Inherited
toString():String
Appends the regular toString value with the instance's playableID.
PlayableBase
Protected Methods
 MethodDefined by
  
_addStep(item:IPlayable, addToLastStep:Boolean = false, stepTypeAsClass:* = null):int
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
  
Developers: Add a getter called currentStep to your subclass as in Sequence.
SequenceBase
  
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
Events
 EventSummaryDefined 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
Property detail
lengthproperty
length:int  [read-only]

The number of steps in the sequence.

Implementation
    public function get length():int
playIndexproperty 
playIndex:int  [read-only]

The current play index of the sequence, starting a 0.

Implementation
    public function get playIndex():int
repeaterproperty 
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
stepsproperty 
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

Constructor detail
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.
Method detail
_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.

Parameters
item: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.)

Returns
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.

Parameters
index: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.)

Returns
int — New length of the steps array.
_getCurrentStep()method 
protected function _getCurrentStep():*

Developers: Add a getter called currentStep to your subclass as in Sequence.

Returns
* — 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.

Returns
* — 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.

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

Returns
* — 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.

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

Returns
* — 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.

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

Returns
* — Developers: return the correct SequenceStep type for your subclass in your corresponding public method.
pause()method 
public function pause():Boolean

Pauses sequence play.

Returns
Boolean — Returns true unless sequence was unable to pause any children.
resume()method 
public function resume():Boolean

Resumes previously-paused sequence play.

Returns
Boolean — Returns true unless sequence was unable to resume any children.
skipTo()method 
public function skipTo(index:Number):Boolean

Stops the current step and skips to another step by sequence index.

Parameters
index:Number

Returns
Boolean — Always returns true since the index is normalized to the sequence.
start()method 
public function start():Boolean

Begins 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.

Returns
Boolean — Returns true unless there are no steps in the sequence.
stop()method 
public function stop():Boolean

Stops all activity and dispatches a GoEvent.STOP event.

Returns
Boolean — Returns true unless sequence was already stopped.
Event detail
ADVANCEevent 
Event object type: org.goasap.events.SequenceEvent
SequenceEvent.type property = org.goasap.events.SequenceEvent.ADVANCE

Dispatched when the sequence advances to its next step.

COMPLETEevent  
Event object type: 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.)

CYCLEevent  
Event object type: 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.

PAUSEevent  
Event object type: org.goasap.events.GoEvent

Dispatched when the sequence is paused successfully.

RESUMEevent  
Event object type: org.goasap.events.GoEvent

Dispatched when the sequence is resumed successfully.

STARTevent  
Event object type: org.goasap.events.GoEvent

Dispatched when the sequence starts.

STOPevent  
Event object type: 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.