Global Functions
39
Usage 3: The following example creates an array with three defined elements:
var myArray:Array = Array("firstElement", "secondElement", "thirdElement");
trace (myArray); // traces firstElement,secondElement,thirdElement
Unlike the Array class constructor, the Array() function does not use the
keyword new .
See also
Array
Boolean function
Boolean(
expression:Object
)
: Boolean
Converts the parameter
expression
to a Boolean value and returns a value as described in the
following list:
■
If
expression
is a Boolean value, the return value is
expression
.
■
If
expression
is a number, the return value is
true
if the number is not zero; otherwise
the return value is
false
.
If
expression
is a string, the return value is as follows:
■
In files published for Flash Player 6 or earlier, the string is first converted to a number; the
value is
true
if the number is not zero,
false
otherwise.
■
In files published for Flash Player 7 or later, the result is
true
if the string has a length
greater than zero; the value is
false
for an empty string.
If
expression
is a string, the result is
true
if the string has a length greater than zero; the
value is
false
for an empty string.
■
If
expression
is
undefined
or
NaN
(not a number), the return value is
false
.
■
If
expression
is a movie clip or an object, the return value is
true
.
Unlike the Boolean class constructor, the Boolean() function does not use the keyword new .
Moreover, the Boolean class constructor initializes a Boolean object to false if no parameter is
specified, while the Boolean() function returns undefined if no parameter is specified.
Availability:
ActionScript 1.0; Flash Lite 2.0 - Behavior changed in Flash Player 7.
Parameters
expression
:
Object
- An expression to convert to a Boolean value.
Returns
Boolean
- A Boolean value.
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...