Boolean() vs "as Boolean"
I came across an interesting quirk in Flex today.
I was trying to convert the string "false" to a boolean false. Initially I had this code:
var str:String = "false";
var isDefault:Boolean = Boolean(str);
var isDefault:Boolean = Boolean(str);
isDefault always had a value of true. According to the Flex documenation any non empty string value is considered true.
This works as expected:
var str:String = "false";
var isDefault:Boolean = str as Boolean;
var isDefault:Boolean = str as Boolean;



There are no comments for this entry.
[Add Comment]