开发者

Testing Boolean in Actionscript for null

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 开发者_如何学Pythonby 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜