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 identifies the current value of the variable hairColor in the movie<br />

clip person_mc:<br />

person_mc.hairColor<br />

The Flash 4 authoring environment did not support dot syntax, but Flash MX 2004 files<br />

published for Flash Player 4 can use the dot operator. The preceding example is equivalent to<br />

the following (deprecated) Flash 4 syntax:<br />

/person_mc:hairColor<br />

The following example creates a new movie clip within the _root scope. Then a text field is<br />

created inside the movie clip called container_mc. The text field's autoSize property is set<br />

to true <strong>and</strong> then populated with the current date.<br />

this.createEmptyMovieClip("container_mc", this.getNextHighestDepth());<br />

this.container_mc.createTextField("date_txt", this.getNextHighestDepth(),<br />

0, 0, 100, 22);<br />

this.container_mc.date_txt.autoSize = true;<br />

this.container_mc.date_txt.text = new Date();<br />

The dot (.) operator is used when targeting instances within the SWF file <strong>and</strong> when you need<br />

to set properties <strong>and</strong> values for those instances.<br />

== equality operator<br />

expression1 == expression2<br />

Tests two expressions for equality. The result is true if the expressions are equal.<br />

The definition of equal depends on the data type of the parameter:<br />

■ Numbers <strong>and</strong> Boolean values are compared by value <strong>and</strong> are considered equal if they have<br />

the same value.<br />

■ String expressions are equal if they have the same number of characters <strong>and</strong> the characters<br />

are identical.<br />

■ Variables representing objects, arrays, <strong>and</strong> functions are compared by reference. Two such<br />

variables are equal if they refer to the same object, array, or function. Two separate arrays<br />

are never considered equal, even if they have the same number of elements.<br />

When comparing by value, if expression1 <strong>and</strong> expression2 are different data types,<br />

ActionScript will attempt to convert the data type of expression2 to match that of<br />

expression1.<br />

Operators 135

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

Saved successfully!

Ooh no, something went wrong!