A-C > Boolean (object)

 

Boolean (object)

The Boolean object is a wrapper object with the same functionality as the standard JavaScript Boolean object. Use the Boolean object to retrieve the primitive data type or string representation of a Boolean object. In Flash MX, the Boolean object has become a native object. As such, you will experience dramatic improvement in performance.

You must use the constructor new Boolean() to create an instance of the Boolean object before calling its methods.

 
Method summary for the Boolean object

Method

Description

Boolean.toString

Returns the string representation (true) or (false) of the Boolean object.

Boolean.valueOf

Returns the primitive value type of the specified Boolean object.


 
Constructor for the Boolean object

Availability

Flash Player 5.

Usage

new Boolean([x])

Parameters

x Any expression. This parameter is optional.

Returns

Nothing.

Description

Constructor; creates an instance of the Boolean object. If you omit the x parameter, the Boolean object is initialized with a value of false. If you specify a value for the x parameter, the method evaluates it and returns the result as a Boolean value according to the rules in the Boolean (function) function.

Note: To maintain compatibility with Flash Player 4, the handling of strings by the Boolean object is not ECMA-262 standard.

Example

The following code creates a new empty Boolean object called myBoolean.

myBoolean = new Boolean();