org.as2lib.core.BasicClass +--org.as2lib.app.exec.Call
ForEachExecutable
Call
enables another object to call a method in another scope without
having to know the scope.
This enables you to pass a call to another object and let the object execute the call without losing its scope. You use the execute method to do so.
public function Call(object, method:Function)
Constructs a new Call
instance.
object | the object to execute the method on |
method | the method to execute |
IllegalArgumentException | if either object or method is
null or undefined
|
public function execute()
Executes the method on the object passing the given arguments
and returns the
result of the execution.
the result of the method execution
public function forEach(object):Array
Iterates over the passed-in object
using the for..in loop and executes
this call passing the found member, its name and the passed-in object
.
Example:
class MyClass {
private var a:String;
private var b:String;
private var c:String;
public function MyClass() {
a = "1";
b = "2";
c = "2";
}
public function traceObject(value, name:String, inObject):Void {
trace(name + ": " + value);
}
public function listAll() {
new Call(this, traceObject).forEach(this);
}
}
Note that only members visible to for..in loops cause the execute method to be invoked.
object | the object to iterate over |
public function toString():String
Returns the string representation of this call.
the string representation of this call
toString() in org.as2lib.core.BasicInterface