| Package | org.spicefactory.lib.task.util |
| Class | public class DelegateTask |
| Inheritance | DelegateTask Task flash.events.EventDispatcher |
Task, but need to act as children of a TaskGroup.
| Method | Defined By | ||
|---|---|---|---|
DelegateTask(startFunction:Function, name:String = null, isRestartable:Boolean = true, timeout:uint = 0)
Creates a new instance. | DelegateTask | ||
![]() | cancel():Boolean
Cancels this Task. | Task | |
markComplete():Boolean
Signals that this Task has completed. | DelegateTask | ||
markError(message:String):Boolean
Signals an error condition and cancels the Task. | DelegateTask | ||
![]() | resume():Boolean
Resumes this Task if it is suspended. | Task | |
setCancelFunction(cancelFunction:Function):void
Instruct the DelegateTask to execute the specified Function when it gets cancelled. | DelegateTask | ||
setSkipFunction(skipFunction:Function):void
Instruct the DelegateTask to execute the specified Function when its finish
method gets executed. | DelegateTask | ||
setSupendFunctions(suspendFunction:Function, resumeFunction:Function):void
Instruct the DelegateTask to execute the specified Functions when it gets suspended
and resumed. | DelegateTask | ||
![]() | skip():Boolean
Forces this Task to move to its final state. | Task | |
![]() | start():Boolean
Starts this Task. | Task | |
![]() | suspend():Boolean
Suspends this Task. | Task | |
| DelegateTask | () | Constructor |
public function DelegateTask(startFunction:Function, name:String = null, isRestartable:Boolean = true, timeout:uint = 0)
Creates a new instance. The properties cancelable, suspendable
and finishable will initially be set to false until
you set one of the corresponding delegate functions (like setCancelFunction).
startFunction:Function — the function that gets executed when the Task is started
| |
name:String (default = null) — an optioanal name for log output
| |
isRestartable:Boolean (default = true) — whether this DelegateTask is restartable
| |
timeout:uint (default = 0) — an optional timeout in milliseconds
|
| markComplete | () | method |
public function markComplete():Boolean
Signals that this Task has completed.
If this method executes successfully
the COMPLETE event will be fired.
Boolean — true if the Task successfully switched its internal state, false if otherwise
|
| markError | () | method |
public function markError(message:String):Boolean
Signals an error condition and cancels the Task.
If this method executes successfully the ERROR event will be fired.
Parameters
message:String — the error description
|
Boolean — true if the Task successfully switched its internal state, false if otherwise
|
| setCancelFunction | () | method |
public function setCancelFunction(cancelFunction:Function):void
Instruct the DelegateTask to execute the specified Function when it gets cancelled.
This method will automatically set the cancelable property to true.
Parameters
cancelFunction:Function — the Function to execute when this Task gets cancelled
|
| setSkipFunction | () | method |
public function setSkipFunction(skipFunction:Function):void
Instruct the DelegateTask to execute the specified Function when its finish
method gets executed.
This method will automatically set the skippable property to true.
Parameters
skipFunction:Function — the Function to execute when the skip
method of this Task gets executed
|
| setSupendFunctions | () | method |
public function setSupendFunctions(suspendFunction:Function, resumeFunction:Function):void
Instruct the DelegateTask to execute the specified Functions when it gets suspended
and resumed.
This method will automatically set the suspendable property to true.
Parameters
suspendFunction:Function — the Function to execute when this Task is suspended
| |
resumeFunction:Function — the Function to execute when this Task is resumed
|