Packagesystem.process
Classpublic class Chain
InheritanceChain Inheritance TaskGroup Inheritance CoreAction Inheritance Task Inheritance Object

A chain is a sequence with a finite or infinite number of actions. All actions registered in the chain can be executed one by one with different strategies (loop, auto remove, etc).

Example :

     package examples
     {
         import system.events.ActionEvent;
         import system.process.Action;
         import system.process.Chain;
         import system.process.Pause;
         
         import flash.display.Sprite;
         
         [SWF(width="740", height="480", frameRate="24", backgroundColor="#666666")]
         
         public class ChainBasicExample extends Sprite
         {
             public function ChainBasicExample()
             {
                 var chain:Chain = new Chain() ;
                 
                 chain.addEventListener( ActionEvent.FINISH   , debug ) ;
                 chain.addEventListener( ActionEvent.PROGRESS , debug ) ;
                 chain.addEventListener( ActionEvent.START    , debug ) ;
                 
                 chain.finishIt.connect( finish ) ;
                 chain.progressIt.connect( progress ) ;
                 chain.startIt.connect( start  ) ;
                 
                 chain.addAction( new Pause(1) ) ;
                 chain.addAction( new Pause(1) ) ;
                 chain.addAction( new Pause(1) ) ;
                 
                 chain.run() ;
             }
             
             public function debug( e:ActionEvent ):void
             {
                 trace( "debug " + e.type ) ;
             }
             
             public function finish( action:Action ):void
             {
                 trace( "finish" ) ;
             }
             
             public function progress( action:Action ):void
             {
                 trace( "progress : " + (action as Chain).current ) ;
             }
             
             public function start( action:Action ):void
             {
                 trace( "start" ) ;
             }
         }
     }
     



Public Properties
 PropertyDefined By
 InheritedchangeIt : Signaler
This signal emit when the notifyChanged method is invoked.
CoreAction
 InheritedclearIt : Signaler
This signal emit when the notifyCleared method is invoked.
CoreAction
  current : Action
[read-only] Indicates the current Action reference when the chain process is running.
Chain
  currentLoop : uint
[read-only] Indicates the current countdown loop value.
Chain
 InheritedfinishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Task
 Inheritedfixed : Boolean
Indicates whether the group length is fixed (true) or can be changed (false).
TaskGroup
 InheritedinfoIt : Signaler
This signal emit when the notifyInfo method is invoked.
CoreAction
 Inheritedlength : uint
Indicates the numbers of actions register in the task-group.
TaskGroup
 Inheritedlogger : Logger
Determinates the internal Logger reference of this Loggable object.
Task
 Inheritedlooping : Boolean
The flag to determinate if the Action object is looped.
CoreAction
 InheritedloopIt : Signaler
This signal emit when the notifyLooped method is invoked.
CoreAction
 Inheritedmode : String
Determinates the mode of the group.
TaskGroup
  numLoop : uint
Specifies the number of the times the chain should loop during playback.
Chain
 InheritedpauseIt : Signaler
This signal emit when the notifyPause method is invoked.
CoreAction
 Inheritedphase : String
[read-only] The current phase of the action.
Task
  position : uint
[read-only] Indicates the current numeric position of the chain.
Chain
 InheritedprogressIt : Signaler
This signal emit when the notifyProgress method is invoked.
CoreAction
 InheritedresumeIt : Signaler
This signal emit when the notifyResumed method is invoked.
CoreAction
 Inheritedrunning : Boolean
[read-only] Indicates true if the process is in progress.
Task
 InheritedstartIt : Signaler
This signal emit when the notifyStarted method is invoked.
Task
 InheritedstopIt : Signaler
This signal emit when the notifyStopped method is invoked.
CoreAction
 Inheritedstopped : Boolean
[read-only] Indicates if the group is stopped.
TaskGroup
 InheritedtimeoutIt : Signaler
This signal emit when the notifyTimeOut method is invoked.
CoreAction
 Inheritedverbose : Boolean
Defines the verbose mode of the task group (use it in the toString() method)
TaskGroup
Public Methods
 MethodDefined By
  
Chain(length:uint = 0, fixed:Boolean = false, looping:Boolean = false, numLoop:uint = 0, mode:String = normal, actions:* = null)
Creates a new Chain instance.
Chain
 Inherited
addAction(action:Action, priority:int = 0, autoRemove:Boolean = false):Boolean
Adds an Action in the task-group.
TaskGroup
  
clone():*
[override] Returns a shallow copy of this object.
Chain
 Inherited
dispose():void
Dispose the task-group and disconnect all actions but don't remove them.
TaskGroup
  
Retrieves the next action reference in the chain with the current position.
Chain
 Inherited
getActionAt(index:uint):Action
Returns the action register in the task group at the specified index value or null.
TaskGroup
 Inherited
hasAction(action:Action):Boolean
Returns true if the specified Action is register in the task-group.
TaskGroup
  
hasNext():Boolean
Indicates if the chain contains a next action (based with the current position value).
Chain
 Inherited
isEmpty():Boolean
Returns true if the task-group is empty.
TaskGroup
 Inherited
isLocked():Boolean
Returns true if the object is locked.
Task
 Inherited
lock():void
Locks the object.
Task
 Inherited
Notify when the process is changed.
CoreAction
 Inherited
Notify when the process is cleared.
CoreAction
 Inherited
Notify an ActionEvent when the process is finished.
Task
 Inherited
notifyInfo(info:*):void
Notify a specific information when the process is changed.
CoreAction
 Inherited
Notify when the process is looped.
CoreAction
 Inherited
Notify when the process is paused.
CoreAction
 Inherited
Notify when the process is in progress.
CoreAction
 Inherited
Notify when the process is resumed.
CoreAction
 Inherited
Notify an ActionEvent when the process is started.
Task
 Inherited
Notify when the process is stopped.
CoreAction
 Inherited
Notify when the process is out of time.
CoreAction
 Inherited
removeAction(action:Action = null):Boolean
Remove a specific action register in the task group and if the passed-in argument is null all actions register in the chain are removed.
TaskGroup
  
resume():void
[override] Resume the chain.
Chain
  
run(... arguments):void
[override] Launchs the chain process.
Chain
 Inherited
setup(length:uint = 0, fixed:Boolean = false):void
Sets the internal Vector of the group.
TaskGroup
 Inherited
start():void
Starts the chain.
TaskGroup
  
stop():void
[override] Stops the chain.
Chain
 Inherited
toArray():Array
Returns the Array representation of the object.
TaskGroup
 Inherited
toString():String
Returns the String representation of the object.
TaskGroup
 Inherited
toVector(fixed:Boolean = false):Vector.<Action>
Returns the Vector (of Action) representation of the chain.
TaskGroup
 Inherited
unlock():void
Unlocks the display.
Task
Protected Methods
 MethodDefined By
  
next(action:Action = null):void
[override] Run the next action in the chain.
Chain
 Inherited
setRunning(b:Boolean):void
Changes the running property value.
Task
Public Constants
 ConstantDefined By
  EVERLASTING : String = everlasting
[static] Determinates the "everlasting" mode of the chain.
Chain
  NORMAL : String = normal
[static] Determinates the "normal" mode of the chain.
Chain
  TRANSIENT : String = transient
[static] Determinates the "transient" mode of the chain.
Chain
Property Detail
currentproperty
current:Action  [read-only]

Indicates the current Action reference when the chain process is running.


Implementation
    public function get current():Action
currentLoopproperty 
currentLoop:uint  [read-only]

Indicates the current countdown loop value.


Implementation
    public function get currentLoop():uint
numLoopproperty 
public var numLoop:uint

Specifies the number of the times the chain should loop during playback.

positionproperty 
position:uint  [read-only]

Indicates the current numeric position of the chain.


Implementation
    public function get position():uint
Constructor Detail
Chain()Constructor
public function Chain(length:uint = 0, fixed:Boolean = false, looping:Boolean = false, numLoop:uint = 0, mode:String = normal, actions:* = null)

Creates a new Chain instance.

Parameters
length:uint (default = 0) — The initial length (number of elements) of the Vector. If this parameter is greater than zero, the specified number of Vector elements are created and populated with the default value appropriate to the base type (null for reference types).
 
fixed:Boolean (default = false) — Whether the chain length is fixed (true) or can be changed (false). This value can also be set using the fixed property.
 
looping:Boolean (default = false) — Specifies whether playback of the clip should continue, or loop (default false).
 
numLoop:uint (default = 0) — Specifies the number of the times the presentation should loop during playback.
 
mode:String (default = normal) — Specifies the mode of the chain. The mode can be "normal" (default), "transient" or "everlasting".
 
actions:* (default = null) — A dynamic object who contains Action references to initialize the chain.
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this object.

Returns
* — a shallow copy of this object.
element()method 
public function element():*

Retrieves the next action reference in the chain with the current position.

Returns
*
hasNext()method 
public function hasNext():Boolean

Indicates if the chain contains a next action (based with the current position value).

Returns
Boolean
next()method 
override protected function next(action:Action = null):void

Run the next action in the chain.

Parameters

action:Action (default = null)

resume()method 
override public function resume():void

Resume the chain.

run()method 
override public function run(... arguments):void

Launchs the chain process.

Parameters

... arguments

stop()method 
override public function stop():void

Stops the chain. Stop only the current action if is running.

Constant Detail
EVERLASTINGConstant
public static const EVERLASTING:String = everlasting

Determinates the "everlasting" mode of the chain. In this mode the action register in the chain can't be auto-remove.

NORMALConstant 
public static const NORMAL:String = normal

Determinates the "normal" mode of the chain. In this mode the chain has a normal life cycle.

TRANSIENTConstant 
public static const TRANSIENT:String = transient

Determinates the "transient" mode of the chain. In this mode all actions are strictly auto-remove in the chain when are invoked.