ActionScript for Flash MX: The Definitive Guide, 2nd Edition By Colin Moock
Chapter 18. ActionScript Language Reference
Boolean( ) Global Function
Flash 5
convert a value to the boolean datatype
Boolean(value)
Arguments
value
An expression containing the value to be converted to a Boolean.
Returns
The result of converting value to a primitive Boolean (either true or false).
Description
The Boolean( ) global function converts its argument to a primitive Boolean value and returns that converted value. The results of converting various datatypes to a primitive Boolean are described in Table 3-3 in Chapter 3. It's normally not necessary to use the Boolean( ) function; ActionScript automatically converts values to the boolean type when appropriate.
Usage
Be sure not to confuse the global Boolean( ) function with the Boolean class constructor. The Boolean( ) function converts its argument to the boolean datatype, whereas the Boolean class constructor creates a new Boolean object. Note that in ECMA-262, all nonempty strings convert to true. In Flash, only strings that can be converted to a valid nonzero number convert to true. Therefore, even the string "true" converts to the Boolean false.
Example
var x = 1; if (Boolean(x)) { trace("x is true"); }
See Also
The Boolean class; "Datatype Conversion," in Chapter 3