ActionScript: conversion to Boolean

Categories: Flex; Tagged with: ; @ February 27th, 2012 19:46

The following table summarizes the results of casting to the Boolean data type from other data types:

Data type or value Result of conversion to Boolean
String false if the value is null or the empty string ( “” ); true otherwise.
null false
Number, int or uint false if the value is NaN or 0; true otherwise.
Object false if the instance is null ; true otherwise.

ref:http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7f87.html

Note: when you convert a string to boolean, remeber to trim the string first.

and this is a capture from <<Essential ActionScript 3.0>>:

image

<->



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.