// define a generic function for __resolve to call
myObject.myFunction = function (name) {
arguments.shift();
trace("Method " + name + " was called with arguments: " +
arguments.join(','));
};
// define the __resolve function
myObject.__resolve = function (name) {
// reserve the name "onStatus" for local use
if (name == "onStatus") {
return undefined;
}
var f:Function = function () {
arguments.unshift(name);
this.myFunction.apply(this, arguments);
};
// create a new object method and assign it the reference
this[name] = f;
// return the reference to the function
return f;
};
// test __resolve using undefined method names with parameters
myObject.someMethod("hello");
// output: Method someMethod was called with arguments: hello
myObject.someOtherMethod("hello","world");
// output: Method someOtherMethod was called with arguments: hello,world
See also
,
arguments
Array
toString (Object.toString method)
public toString() : String
Converts the specified object to a string and returns it.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
- A string.
String
Object
563