Access keys

Call

Kind of class: class
Inherits from: BasicClass
Implements:
Known subclasses:
Author: Simon Wacker, Martin Heidegger
Classpath: org.as2lib.app.exec.Call
File last modified: Wednesday, 17 August 2005, 14:57:56
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.

Summary

Constructor
Instance methods
Instance methods inherited from BasicClass

Constructor

Call

function Call (
object, method:Function)
Constructs a new Call instance.
Parameters:
object:
the object to execute the method on
method:
the method to execute
Throws:
org.as2lib.env.except.IllegalArgumentException if either object or method is
null or undefined

Instance methods

execute

function execute (
)
Executes the method on the object passing the given arguments and returns the
result of the execution.
Returns:
the result of the method execution
Specified by:

forEach

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.

Parameters:
object:
the object to iterate over
Returns:
list with the result of each execution
#

toString

function toString (
) : String
Returns the string representation of this call.
Returns:
the string representation of this call