Class org.as2lib.app.exec.Timeout

org.as2lib.app.exec.AbstractProcess
   +--org.as2lib.app.exec.Timeout

Implemented Interfaces

ForEachExecutable

Description

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");

Method Index

new Timeout()

execute(), forEach(), run(), setExecutable(), setExecutableByObjectAndFunction(), setTimeout()

Inherited from AbstractProcess

addAllProcessListeners(), addProcessListener(), getAllProcessListeners(), getParentProcess(), getPercentage(), hasFinished(), hasStarted(), isPaused(), isRunning(), onFinishProcess(), onPauseProcess(), onProcessError(), onResumeProcess(), onStartProcess(), onUpdateProcess(), pause(), removeAllProcessListeners(), removeProcessListener(), resume(), setParentProcess(), start(), startSubProcess()

Constructor Detail

Timeout

public function Timeout()

Creates a new Timeout instance.

Method Detail

setTimeout

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.

Parameters

exeExecutable to excute after a delay
framesAmout of frames during the end of the execution
argsArguments to be passed at execution

setExecutable

public function setExecutable(exe:Executable, frames:Number):Void

Sets the connected executable.

Parameters

exeExecutable to be executed after the delay
framesDelay in frames until execution.

setExecutableByObjectAndFunction

public function setExecutableByObjectAndFunction(inObject:Object, func:Function, frames:Number):Void

Sets the connected executable with a generated call.

Parameters

inObjectScope of the execution
funcMethod to execute
framesDelay in frames until execution.

execute

public function execute()

Starts the delay until the execution of the connected Executable.

run

public function run(Void):Void

Referes to execute.

Implementation of AbstractProcess.run for using it as a process.

forEach

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];
 

Parameters

objectObject to be iterated

Return

null as the result isn't available yet.

Specified By

forEach() in org.as2lib.app.exec.ForEachExecutable