Object
563
// 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
String
- A string.
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...