Flash Lite 1.x ActionScript Language Reference |
|
|
|
| Flash Lite Global Functions > Number() | |||
Flash Lite 1.0.
Number(expression)
expression An expression to convert to a number.
Function; converts the parameter expression to a number and returns a value as described in the following list:
expression is a number, the return value is expression.expression is a Boolean value, the return value is 1 if expression is true; 0 if expression is false.expression is a string, the function attempts to parse expression as a decimal number with an optional trailing exponent (that is, 1.57505e-3).expression is undefined, the return value is -1.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
|
|
|
|