I have a Boolean variable in Actionscript 3.
How can I check if it's undefined (not by being false) because false is a value or Boolean in Actionscript is FALSE by default >
If you want a Boolean that can be undefined (essentially a tri-state flag), you can use an Object reference, but just assign the Boolean values true and false to it. Downside is that you lose the type safety.
var isSet:Object = null;
// Later...
isSet = true;
In ActionScript, Boolean can have either true or false value only. If you don't specify any value, it is initialized to false by default.
Edit: This behavior is different from Java's Boolean object type which is a wrapper over primitive boolean. See @Victor's comments below
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With