Object.__resolve
Availability
Flash Player 6.
Usage
myObject.__resolve = function (name:String) {
// your statements here
};
Parameters
A string representing the name of the undefined property.
name
Returns
Nothing
Description
Property; a reference to a user-defined function that is invoked if ActionScript code refers to an
undefined property or method. If ActionScript code refers to an undefined property or method of
an object, Flash Player determines whether the object's
is defined, the function to which it refers is executed and passed the name of the
__resolve
undefined property or method. This lets you programmatically supply values for undefined
properties and statements for undefined methods and make it seem as if the properties or
methods are actually defined.
This property is useful for enabling highly transparent client/server communication, and is the
recommended way of invoking server-side methods.
Example
The following examples progressively build upon the first example and illustrate five different
usages of the
__resolve
previous usage are in bold typeface.
Usage 1: the following example uses
property returns the value
// instantiate a new object
var myObject:Object = new Object();
// define the __resolve function
myObject.__resolve = function (name) {
return "Hello, world!";
};
trace (myObject.property1); // output: Hello, world!
trace (myObject.property2); // output: Hello, world!
Usage 2: the following example uses
functions. Using
.
myFunction
// instantiate a new object
668
Chapter 2: ActionScript Language Reference
property. To aid understanding, key statements that differ from the
__resolve
"Hello, world!"
__resolve
redirects undefined method calls to a generic function named
__resolve
property is defined. If
__resolve
to build an object where every undefined
.
as a functor, which is a function that generates
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers