03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - 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.

if (shouldExecute == true) {<br />

trace("your statements here");<br />

}<br />

// true is also implied, so the if statement could also be written:<br />

// if (shouldExecute) {<br />

// trace("your statements here");<br />

// }<br />

The following example shows how automatic data typing converts true to the number 1:<br />

var myNum:Number;<br />

myNum = 1 + true;<br />

trace(myNum); // output: 2<br />

See also<br />

false constant, Boolean<br />

undefined constant<br />

A special value, usually used to indicate that a variable has not yet been assigned a value. A<br />

reference to an undefined value returns the special value undefined. The <strong>ActionScript</strong> code<br />

typeof(undefined) returns the string "undefined". The only value of type undefined is<br />

undefined.<br />

In files published for Flash Player 6 or earlier, the value of String(undefined) is "" (an<br />

empty string). In files published for Flash Player 7 or later, the value of String(undefined)<br />

is "undefined" (undefined is converted to a string).<br />

In files published for Flash Player 6 or earlier, the value of Number(undefined) is 0. In files<br />

published for Flash Player 7 or later, the value of Number(undefined) is NaN.<br />

The value undefined is similar to the special value null. When null <strong>and</strong> undefined are<br />

compared with the equality (==) operator, they compare as equal. However, when null <strong>and</strong><br />

undefined are compared with the strict equality (===) operator, they compare as not equal.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Constants 41

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

Saved successfully!

Ooh no, something went wrong!