User Guide

Table Of Contents
32 Flash Lite Global Functions
Number()
Availability
Flash Lite 1.0.
Usage
Number(expression)
Operands
expression An expression to convert to a number.
Description
Function; converts the parameter expression to a number and returns a value as described in
the following list:
If expression is a number, the return value is expression.
If expression is a Boolean value, the return value is 1 if expression is true; 0 if
expression is false.
If expression is a string, the function attempts to parse expression as a decimal
number with an optional trailing exponent (that is, 1.57505e-3).
If expression is undefined, the return value is -1.
Example
The following example converts the string in the myString variable to a number, stores the
number in the
myNumber variable, adds 5 to the number, and stores the result in the variable
myResult. The final line shows the result when you call Number() on a Boolean value.
myString = "55";
myNumber = Number(myString);
myResult = myNumber + 5;
trace (myResult); // Output: 60
trace (Number(true));// Output: 1