In AS2 using the Boolean constructor will instantiate a Boolean object - an
object wrapper for the primitive type. If you want to perform logical
operations on the value of a Boolean object you must remember to use the
objects valueOf() method. Otherwise it's the object, rather than its value,
that gets evaluated - and as Fumio pointed evaluating any object as a
Boolean will result in a positive. 

var primative:Boolean = false;
var object:Boolean = new Boolean(false);
trace( [ typeof primative, !primative, !primative.valueOf() ] );
trace( [ typeof object, !object, !object.valueOf() ] );

// AS2 output:
// boolean,true,true
// object,false,true

In AS3 the two statements are equivalent...

// AS3 output:
// boolean,true,true
// boolean,true,true


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to