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.

Example<br />

The following example is a reference to the constructor function for the myObject object.<br />

var my_str:String = new String("sven");<br />

trace(my_str.constructor == String); //output: true<br />

If you use the instanceof operator, you can also determine if an object belongs to a specified<br />

class:<br />

var my_str:String = new String("sven");<br />

trace(my_str instanceof String); //output: true<br />

However, in the following example the Object.constructor property converts primitive<br />

data types (such as the string literal seen here) into wrapper objects. The instanceof operator<br />

does not perform any conversion, as seen in the following example:<br />

var my_str:String = "sven";<br />

trace(my_str.constructor == String); //output: true<br />

trace(my_str instanceof String); //output: false<br />

See also<br />

instanceof operator<br />

hasOwnProperty (Object.hasOwnProperty method)<br />

public hasOwnProperty(name:String) : Boolean<br />

Indicates whether an object has a specified property defined. This method returns true if the<br />

target object has a property that matches the string specified by the name parameter, <strong>and</strong><br />

false otherwise. This method does not check the object's prototype chain <strong>and</strong> returns true<br />

only if the property exists on the object itself.<br />

Parameters<br />

name:String -<br />

Returns<br />

Boolean - A Boolean value: true if the target object has the property specified by the name<br />

parameter, false otherwise.<br />

isPropertyEnumerable<br />

(Object.isPropertyEnumerable method)<br />

public isPropertyEnumerable(name:String) : Boolean<br />

524 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!