Class: Chain

system.process. Chain


new Chain( [looping] [, numLoop] [, mode] [, actions])

A chain is a sequence with a finite or infinite number of actions.

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

Parameters:
Name Type Argument Default Description
looping boolean <optional>
false

Specifies whether playback of the clip should continue, or loop (default false).

numLoop number <optional>
0

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

mode string <optional>
normal

Specifies the mode of the group. This mode can be "normal" (default), "transient" or "everlasting".

actions array <optional>
null

An optional array who contains Action references to initialize the chain.

Example
var do1 = new system.process.Do() ;
var do2 = new system.process.Do() ;

do1.something = function()
{
    trace( "do1 something" ) ;
}

do2.something = function()
{
    trace( "do2 something" ) ;
}

var finish = function( action )
{
    trace( "finish: " + action ) ;
};

var progress = function( action )
{
    trace( "progress: " + action ) ;
};

var start = function( action )
{
    trace( "start: " + action ) ;
};

var chain = new system.process.Chain() ;

chain.finishIt.connect(finish) ;
chain.progressIt.connect(progress) ;
chain.startIt.connect(start) ;

chain.add( do1 , 0 ) ;
chain.add( do2 , 2 , true) ;

chain.verbose = true ;

trace('---------') ;

trace( 'chain   : ' + chain.toString(true) ) ;
trace( 'running : ' + chain.running ) ;
trace( 'length  : ' + chain.length ) ;

trace('---------') ;

chain.run() ;

trace('---------') ;

chain.run() ;

Extends

Members


<constant> changeIt :system.signals.Signal

The signal emit when the task is changed.

Type:
Inherited From:

<constant> clearIt :system.signals.Signal

The signal emit when the task is cleared.

Type:
Inherited From:

<readonly> current :system.process.Action

Indicates the current Action reference when the process is in progress.

Type:

<readonly> currentLoop :number

Indicates the current countdown loop value.

Type:
  • number

<constant> finishIt :system.signals.Signal

This signal emit when the action is finished.

Type:
Inherited From:

<constant> infoIt :system.signals.Signal

The signal emit when the task emit a message.

Type:
Inherited From:

<readonly> length

Indicates the numbers of actions register in the group.

Inherited From:

looping :boolean

Indicates if the chain loop when is finished.

Type:
  • boolean
Overrides:
Default Value:
  • false

<constant> loopIt :system.signals.Signal

The signal emit when the task is looped.

Type:
Inherited From:

mode

Determinates the mode of the chain. The mode can be "normal", "transient" or "everlasting".

Inherited From:
See:
  • system.process.TaskGroup#NORMAL, system.process.TaskGroup#EVERLASTING, system.process.TaskGroup#TRANSIENT

numLoop :number

The number of loops.

Type:
  • number
Default Value:
  • 0

<constant> pauseIt :system.signals.Signal

The signal emit when the task is paused.

Type:
Inherited From:

<readonly> phase :string

Indicates the current phase.

Type:
  • string
Inherited From:
See:

<readonly> position :number

Indicates the current numeric position of the chain when is running.

Type:
  • number

<constant> progressIt :system.signals.Signal

The signal emit when the task is in progress.

Type:
Inherited From:

<constant> resumeIt :system.signals.Signal

The signal emit when the task is resumed.

Type:
Inherited From:

<readonly> running :boolean

Indicates action is running.

Type:
  • boolean
Inherited From:

<constant> startIt :system.signals.Signal

This signal emit when the action is started.

Type:
Inherited From:

<constant> stopIt :system.signals.Signal

This signal emit when the task is stopped.

Type:
Inherited From:

<readonly> stopped

Indicates if the chain is stopped.

Inherited From:

<constant> timeoutIt :system.signals.Signal

The signal emit when the task is out of time.

Type:
Inherited From:

verbose :boolean

Indicates if the toString method must be verbose or not.

Type:
  • boolean
Inherited From:
Default Value:
  • false

Methods


add(action [, priority] [, autoRemove])

Adds an action in the chain.

Parameters:
Name Type Argument Default Description
action system.process.Action

The Action to register in this collection.

priority number <optional>
0

Determinates the priority level of the action in the chain.

autoRemove boolean <optional>
false

Apply a remove after the first finish notification.

Inherited From:
Returns:

true if the insert is success.


clone()

Creates a copy of the object.

Overrides:
Returns:

a shallow copy of this object.


contains()

Returns true if the specified Action is register in the group.

Inherited From:
Returns:

true if the specified Action is register in the group.


dispose()

Dispose the chain and disconnect all actions but don't remove them.

Inherited From:

element()

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


get(index)

Gets the Action register in the collection at the specified index value or null.

Parameters:
Name Type Description
index number

The index of the action element in the collection.

Inherited From:
Returns:

the action register in the chain at the specified index value or null.


hasNext()

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


isEmpty()

Returns true if the collection is empty.

Inherited From:
Returns:

true if the chain is empty.


isLocked()

Returns true if the object is locked.

Inherited From:
Implements:
Returns:

true if the object is locked.


lock()

Locks the object.

Inherited From:
Implements:

notifyChanged()

Notify when the process is changed.

Inherited From:

notifyCleared()

Notify when the process is cleared.

Inherited From:

notifyFinished()

Notify when the process is finished.

Inherited From:

notifyInfo()

Notify a specific information when the process is changed.

Inherited From:

notifyLooped()

Notify when the process is looped.

Inherited From:

notifyPaused()

Notify when the process is paused.

Inherited From:

notifyProgress()

Notify when the process is progress.

Inherited From:

notifyResumed()

Notify when the process is resumed.

Inherited From:

notifyStarted()

Notify when the process is started.

Inherited From:

notifyStopped()

Notify when the process is stopped.

Inherited From:

notifyTimeout()

Notify when the process is out of time.

Inherited From:

remove(action)

Removes a specific action register in the chain and if the passed-in argument is null all actions register in the chain are removed. If the chain is running the stop() method is called.

Parameters:
Name Type Description
action system.process.Action

The action to remove in the collection.

Inherited From:
Returns:

true if the method succeeded.


reset()

Resets the task.

Inherited From:
Implements:

resume()

Resume the chain.

Overrides:

run()

Launchs the chain process.

Overrides:

start()

Starts the task.

Inherited From:
Implements:

stop()

Stops the task group.

Overrides:

toArray()

Invoked when a task is finished.

Inherited From:
Overrides:

toString()

Returns the String representation of the chain.

Inherited From:
Returns:

the String representation of the chain.


unlock()

Unlocks the object.

Inherited From:
Implements: