03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Returns<br />

Boolean - A Boolean value: if the class registration succeeds, a value of true is returned;<br />

false otherwise.<br />

See also<br />

attachMovie (MovieClip.attachMovie method), duplicateMovieClip<br />

(MovieClip.duplicateMovieClip method)<br />

__resolve (Object.__resolve property)<br />

public __resolve : Object<br />

A reference to a user-defined function that is invoked if ActionScript code refers to an<br />

undefined property or method. If ActionScript code refers to an undefined property or<br />

method of an object, Flash Player determines whether the object's __resolve property is<br />

defined. If __resolve is defined, the function to which it refers is executed <strong>and</strong> passed the<br />

name of the undefined property or method. This lets you programmatically supply values for<br />

undefined properties <strong>and</strong> statements for undefined methods <strong>and</strong> make it seem as if the<br />

properties or methods are actually defined. This property is useful for enabling highly<br />

transparent client/server communication, <strong>and</strong> is the recommended way of invoking serverside<br />

methods.<br />

Example<br />

The following examples progressively build upon the first example <strong>and</strong> illustrate five different<br />

usages of the __resolve property. To aid underst<strong>and</strong>ing, key statements that differ from the<br />

previous usage are in bold typeface.<br />

Usage 1: the following example uses __resolve to build an object where every undefined<br />

property returns the value "Hello, world!".<br />

// instantiate a new object<br />

var myObject:Object = new Object();<br />

// define the __resolve function<br />

myObject.__resolve = function (name) {<br />

return "Hello, world!";<br />

};<br />

trace (myObject.property1); // output: Hello, world!<br />

trace (myObject.property2); // output: Hello, world!<br />

Usage 2: the following example uses __resolve as a functor, which is a function that generates<br />

functions. Using __resolve redirects undefined method calls to a generic function named<br />

myFunction.<br />

// instantiate a new object<br />

Object 529

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!