If
is a string, the return value is as follows:
expression
In files published for Flash Player 6 and earlier, the string is first converted to a number.
The value is
true
In files published for Flash Player 7 and later, the result is
greater than 0; the value is
If
is a string, the result is
expression
is
for an empty string.
false
If
is
expression
If
is a movie clip or an object, the return value is
expression
Unlike the Boolean class constructor, the
Moreover, the Boolean class constructor initializes a Boolean object to
is specified, while the
Availability: ActionScript 1.0; Flash Player 5 - Behavior changed in Flash Player 7.
Parameters
expression:Object
Returns
- A Boolean value.
Boolean
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
48
ActionScript language elements
if the number is not 0, otherwise the return value is
for an empty string.
false
true
or
(not a number), the return value is
undefined
NaN
Boolean()
function returns
Boolean()
- An expression to convert to a Boolean value.
true
if the string has a length greater than 0; the value
function does not use the keyword new.
if no parameter is specified.
undefined
.
false
if the string has a length
.
false
.
true
if no parameter
false
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?