Variable auto-conversion rules

Action Script automatically converts a base variable to the appropriate type. The following list illustrates the variable auto-conversion rules from a basic variable type to the other types.

An empty variable is a string that can be equated to the “” value. Strings that consist of only white space characters are also considered empty.

For auto-conversion, long variables are treated as integers.

Converting string variables

Converting Boolean variables

Converting float variables:

Converting integer variables:

The only time auto-conversion can fail is when a string cannot be converted to a numeric equivalent. Auto-conversion rules apply to expression evaluation and to a variable’s values being used as parameters in object methods or object variable methods.