Testing Boolean in ActionScript for null

I have a boolean variable in ActionScript 3.

How can I check if it is undefined (and not false) because false is a value or Boolean in ActionScript is FALSE by default>

+7
source share
2 answers

In ActionScript, a Boolean can only be true or false . If you do not specify any value, it will be initialized to false by default.

Edit: this behavior is different from the Java Boolean object type, which is a wrapper over a primitive Boolean . See @Victor comments below

+7
source

If you want the boolean value to be undefined (essentially a flag of three states), you can use the Object link, but just set it to Boolean true and false . The downside is that you are losing type safety.

 var isSet:Object = null; // Later... isSet = true; 
+11
source

All Articles