EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 48

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
48 ActionScript language elements
If expression is a string, the return value is as follows:
In files published for Flash Player 6 and earlier, the string is first converted to a number.
The value is
true if the number is not 0, otherwise the return value is false.
In files published for Flash Player 7 and later, the result is true if the string has a length
greater than 0; 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 0; 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 Player 5 - Behavior changed in Flash Player 7.
Parameters
expression:Object - An expression to convert to a Boolean value.
Returns
Boolean - A Boolean value.
Example
trace(Boolean(-1)); // output: true
trace(Boolean(0)); // output: false
trace(Boolean(1)); // output: true
trace(Boolean(true)); // output: true
trace(Boolean(false)); // output: false
trace(Boolean("true")); // output: true
trace(Boolean("false")); // output: true
trace(Boolean("Craiggers")); // output: true
trace(Boolean("")); // output: false
If files are published for Flash Player 6 and earlier, the results differ for three of the preceding
examples:
trace(Boolean("true")); // output: false
trace(Boolean("false")); // output: false
trace(Boolean("Craiggers")); // output: false

Table of Contents

Related product manuals