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 />

var myArray:Array = Array();<br />

myArray.push(12);<br />

trace(myArray); //traces 12<br />

myArray[4] = 7;<br />

trace(myArray); //traces 12,undefined,undefined,undefined,7<br />

Usage 2: The following example creates an array of length 4 but with no elements defined:<br />

var myArray:Array = Array(4);<br />

trace(myArray.length); // traces 4<br />

trace(myArray); // traces undefined,undefined,undefined,undefined<br />

Usage 3: The following example creates an array with three defined elements:<br />

var myArray:Array = Array("firstElement", "secondElement", "thirdElement");<br />

trace (myArray); // traces firstElement,secondElement,thirdElement<br />

NOTE<br />

See also<br />

Array<br />

Unlike the Array class constructor, the Array() function does not use the keyword new .<br />

Boolean function<br />

Boolean(expression:Object) : Boolean<br />

Converts the parameter expression to a Boolean value <strong>and</strong> returns a value as described in the<br />

following list:<br />

■ If expression is a Boolean value, the return value is expression.<br />

■ If expression is a number, the return value is true if the number is not zero; otherwise<br />

the return value is false.<br />

If expression is a string, the return value is as follows:<br />

■ In files published for Flash Player 6 or earlier, the string is first converted to a number; the<br />

value is true if the number is not zero, false otherwise.<br />

■ In files published for Flash Player 7 or later, the result is true if the string has a length<br />

greater than zero; the value is false for an empty string.<br />

If expression is a string, the result is true if the string has a length greater than zero; the<br />

value is false for an empty string.<br />

■ If expression is undefined or NaN (not a number), the return value is false.<br />

Global Functions 37

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

Saved successfully!

Ooh no, something went wrong!