MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference page 127

Actionscript language reference
Table of Contents

Advertisement

If files are published for Flash Player 6 or earlier, the results will differ for three of the preceding
examples:
trace(Boolean("true")); // output: false
trace(Boolean("false")); // output: false
trace(Boolean("Craiggers")); // output: false
This example shows a string that will evaluate as
if the file is published for Flash Player 7,
true
but will evaluate as
for Flash Player 6 or earlier:
false
trace(Boolean("0"));
This example shows a significant difference between use of the
function and the
Boolean()
Boolean class. The
function creates a Boolean value, and the Boolean class creates a
Boolean()
Boolean object. Boolean values are compared by value, and Boolean objects are compared by
reference.
// Variables representing Boolean values are compared by value
var a:Boolean = Boolean("a"); // a is true
var b:Boolean = Boolean(1); // b is true
trace(a==b); // true
// Variables representing Boolean objects are compared by reference
var a:Boolean = new Boolean("a"); // a is true
var b:Boolean = new Boolean(1); // b is true
trace(a==b); // false
See also
Boolean class
Boolean()
127

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents