/ Published in: ActionScript 3

When receiving data that contains booleans from JSON, MXML and perhaps even XML, Flash thinks the boolean is a string. If you check to see if the boolean is true, it will always be true unless the value you are checking is null or blank. I created a function that checks to see if a string is true/false.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Recieves a string, checks to see if it is true/false, passes boolean back function checkBoolean(val:String):Boolean { if (val.toLowerCase() == "true") { return true; } else { return false; } }
Comments
