org.as2lib.app.exec.AbstractProcess +--org.as2lib.app.exec.Timeout
ForEachExecutable
Timeout
works as delayed execution of a executable.
As Timeout
implements Executable it works like a usual
executable and can be started with execute.
As Timeout
implements Process its possible to handle it
as process.
Timeout
works framebased, that means you have to define the delay
in number of frames.
Due to the definition of Call all arguments passed-in in execute
will be passed to the connected executable
Example for a direct execution:
import org.as2lib.app.exec.Timeout;
import org.as2lib.app.exec.Call;
Timeout.timeout(new Call(myObj, myMethod), 20, ["1", "2"]);
Example for a controlable usage:
import org.as2lib.app.exec.Timeout;
import org.as2lib.app.exec.Call;
var call:Call = new Call(myObj, myMethod);
var frames:Number = 20;
var t:Timeout = new Timeout(call, frames);
t.execute("argument 1", "argument 2");
new Timeout()
addAllProcessListeners(), addProcessListener(), getAllProcessListeners(), getParentProcess(), getPercentage(), hasFinished(), hasStarted(), isPaused(), isRunning(), onFinishProcess(), onPauseProcess(), onProcessError(), onResumeProcess(), onStartProcess(), onUpdateProcess(), pause(), removeAllProcessListeners(), removeProcessListener(), resume(), setParentProcess(), start(), startSubProcess()
static public function setTimeout(exe:Executable, frames:Number, args:Array)
Simplyfier for the execution of a timeout.
Allows creation and execution of a Timeout
with one call.
exe | Executable to excute after a delay |
frames | Amout of frames during the end of the execution |
args | Arguments to be passed at execution |
public function setExecutable(exe:Executable, frames:Number):Void
Sets the connected executable.
exe | Executable to be executed after the delay |
frames | Delay in frames until execution. |
public function setExecutableByObjectAndFunction(inObject:Object, func:Function, frames:Number):Void
Sets the connected executable with a generated call.
inObject | Scope of the execution |
func | Method to execute |
frames | Delay in frames until execution. |
public function run(Void):Void
Referes to execute.
Implementation of AbstractProcess.run for using it as a process.
public function forEach(object):Array
Executed the Timeout for all iterable objects.
If you execute .forEach to Timeout it will redirect content, name and
the object to each execution of the connected call.
Example:
import org.as2lib.app.exec.Timeout;
function display(content, name, inObject) {
trace("Executed: "+content+", "+name+", "+inObject+";");
}
var t:Timeout = new Timeout(this, display, 40);
t.forEach({a:"1", b:"2", c:"3"});
Delays for 40 frames:
Executed: 1, a, [Object object]; Executed: 2, b, [Object object]; Executed: 3, c, [Object object];
object | Object to be iterated |
null as the result isn't available yet.