| Package | org.springextensions.actionscript.core.task |
| SVN browsing | ITask.as |
| Fisheye | ITask.as |
| Interface | public interface ITask extends ICommand, IOperation, flash.events.IEventDispatcher |
| Subinterfaces | IForBlock, IIfElseBlock, ITransaction, IWhileBlock |
| Implementors | AbstractTaskBlock, Task, TaskFlowControlCommand |
ICommands, both
in sequence and in parallel, including simple flowcontrol logic such as if, else, while and for.
This is a so-called 'fluent' interface allowing method calls to be 'chained', like this:
var task:ITask = new Task(); task.next(new Command1()).next(new Command2()).and(new Command3()).and(new Command4()).execute();
Because ITask itself is an extension of the ICommand interface it is
possible to nest task executions, like this:
var task1:ITask = new Task(); task1.next(new Command1()).next(new Command2()).and(new Command3()).and(new Command4()); var task2:ITask = new Task(); task2.next(task1).next(new Command5()).execute();
Note: An ITask can only be nested in one other execution chain. Do not re-use instances
among different ITasks.
Documentation reference: tasks
| Property | Defined by | ||
|---|---|---|---|
| context : Object
An anonymous object that can be used to store values that can be accessed by other client code
to pass around these values between commands.
| ITask | ||
![]() | error : *
The error of this operation or
null if no error occurred during this operation. | IOperation | |
| parent : ITask
If the current
ITask is part of the execution chain of another ITask,
this property will have a reference to that instance. | ITask | ||
![]() | result : *
The result of this operation or
null if the operation does not have a result. | IOperation | |
![]() | timeout : int
The timeout in milliseconds.
| IOperation | |
| Method | Defined by | ||
|---|---|---|---|
![]() |
addCompleteListener(listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Convenience method for adding a listener to the OperationEvent.COMPLETE event.
| IOperation | |
![]() |
addErrorListener(listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Convenience method for adding a listener to the OperationEvent.ERROR event.
| IOperation | |
![]() |
addTimeoutListener(listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Convenience method for adding a listener to the OperationEvent.TIMEOUT event.
| IOperation | |
|
Adds an
ICommand that will be executed in parallel. | ITask | ||
|
Switches the current
IIfElseBlock control flow to its else block. | ITask | ||
|
Closes the current
ITaskBlock. | ITask | ||
![]() |
execute():*
Executes the command.
| ICommand | |
|
Stops the execution chain completely.
| ITask | ||
|
Adds a repeating execution block which will be executed a specified number of times, determined by the specified
count or ICountProvider parameters. | ITask | ||
|
Adds a conditional execution block to the current
ITask which will only
be executed if the specified IConditionProvider return true. | ITask | ||
|
Adds an
ICommand that will be executed in sequence. | ITask | ||
|
Pauses the current
ITask for the specified amount of milliseconds. | ITask | ||
![]() |
removeCompleteListener(listener:Function, useCapture:Boolean = false):void
Convenience method for removing a listener from the OperationEvent.COMPLETE event.
| IOperation | |
![]() |
removeErrorListener(listener:Function, useCapture:Boolean = false):void
Convenience method for removing a listener from the OperationEvent.ERROR event.
| IOperation | |
![]() |
removeTimeoutListener(listener:Function, useCapture:Boolean = false):void
Convenience method for removing a listener from the OperationEvent.TIMEOUT event.
| IOperation | |
|
Restarts the execution of the current
ITask. | ITask | ||
|
Adds a repeating execution block which will be executed until the specified
IConditionProvider returns false. | ITask | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
![]() |
Dispatched when the current IOperation completed successfully. | IOperation | ||
![]() |
Dispatched when the current IOperation encountered an error. | IOperation | ||
![]() |
Dispatched when the current IOperation timed out. | IOperation | ||
| Dispatched when the task is aborted. | ITask | |||
Dispatched after the task has executed an ICommand. | ITask | |||
Dispatched before the task executes an ICommand. | ITask | |||
| Dispatched when the task is completed. | ITask | |||
| context | property |
context:Object [read-write]An anonymous object that can be used to store values that can be accessed by other client code to pass around these values between commands.
Implementation public function get context():Object
public function set context(value:Object):void
| parent | property |
parent:ITask [read-write]
If the current ITask is part of the execution chain of another ITask,
this property will have a reference to that instance.
public function get parent():ITask
public function set parent(value:ITask):void
| and | () | method |
public function and(command:ICommand):ITask
Adds an ICommand that will be executed in parallel.
command:ICommand — The specified ICommand
|
ITask —
A reference to the current ITask
|
| else_ | () | method |
public function else_():IIfElseBlock
Switches the current IIfElseBlock control flow to its else block.
IIfElseBlock —
The current IIfElseBlock instance.
|
| end | () | method |
| exit | () | method |
public function exit():ITaskStops the execution chain completely.
ReturnsITask —
The current ITask.
|
| for_ | () | method |
public function for_(count:uint, countProvider:ICountProvider = null, forBlock:IForBlock = null):IForBlock
Adds a repeating execution block which will be executed a specified number of times, determined by the specified count or ICountProvider parameters.
count:uint — The specified ICountProvider. This argument is ignored if the forBlock argument is not null.
|
|
countProvider:ICountProvider (default = null) — Optional IForBlock instance, if this is null a new instance will be created.
|
|
forBlock:IForBlock (default = null) |
IForBlock —
The new IForBlock instance.
|
| if_ | () | method |
public function if_(condition:IConditionProvider = null, ifElseBlock:IIfElseBlock = null):IIfElseBlock
Adds a conditional execution block to the current ITask which will only
be executed if the specified IConditionProvider return true.
condition:IConditionProvider (default = null) — The specified IConditionProvider. This argument is ignored if the ifElseBlock argument is not null.
|
|
ifElseBlock:IIfElseBlock (default = null) — Optional IIfElseBlock instance, if this is null a new instance will be created.
|
IIfElseBlock —
The new IIfElseBlock instance.
|
| next | () | method |
public function next(command:ICommand):ITask
Adds an ICommand that will be executed in sequence.
command:ICommand — The specified ICommand
|
ITask —
A reference to the current ITask
|
| pause | () | method |
public function pause(duration:uint, pauseCommand:ICommand = null):ITask
Pauses the current ITask for the specified amount of milliseconds.
duration:uint — The specified amount of milliseconds
|
|
pauseCommand:ICommand (default = null) — ICommand instance to be used as a pause command, if this parameter is not null the duration parameter is ignored.
|
ITask —
The current ITask.
|
| reset | () | method |
public function reset(doHardReset:Boolean = false):ITask
Restarts the execution of the current ITask.
doHardReset:Boolean (default = false) |
ITask —
The current ITask.
|
| while_ | () | method |
public function while_(condition:IConditionProvider = null, whileBlock:IWhileBlock = null):IWhileBlock
Adds a repeating execution block which will be executed until the specified IConditionProvider returns false.
condition:IConditionProvider (default = null) — The specified IConditionProvider. This argument is ignored if the whileBlock argument is not null.
|
|
whileBlock:IWhileBlock (default = null) — Optional IWhileBlock instance, if this is null a new instance will be created.
|
IWhileBlock —
The new IWhileBlock instance.
|
| taskAborted | event |
org.springextensions.actionscript.core.task.event.TaskEvent
org.springextensions.actionscript.core.task.event.TaskEvent.TASK_ABORTED
Dispatched when the task is aborted.
| taskAfterExecuteCommand | event |
org.springextensions.actionscript.core.task.event.TaskEvent
org.springextensions.actionscript.core.task.event.TaskEvent.AFTER_EXECUTE_COMMAND
Dispatched after the task has executed an ICommand.
| taskBeforeExecuteCommand | event |
org.springextensions.actionscript.core.task.event.TaskEvent
org.springextensions.actionscript.core.task.event.TaskEvent.BEFORE_EXECUTE_COMMAND
Dispatched before the task executes an ICommand.
| taskComplete | event |
org.springextensions.actionscript.core.task.event.TaskEvent
org.springextensions.actionscript.core.task.event.TaskEvent.TASK_COMPLETE
Dispatched when the task is completed.