Name
Number( ) Global Function — convert a value to the Number datatype
Availability
Flash 5
Synopsis
Number(value)
Arguments
- value
An expression containing the value to be converted to a number.
Returns
The result of converting value to a
primitive number.
Description
The Number( ) function converts its argument to
a primitive numeric value and returns that converted value. The
results of converting various types of data to a primitive number are
described in Table 3.1. It’s often not
necessary to use the Number( ) function;
ActionScript automatically converts values to the
number type when appropriate.
Be sure not to confuse the global Number( )
function with the Number class constructor. The
former is a function that converts a value to the
number type, whereas the latter is the class
used to wrap a primitive numeric datum in an object that can take
properties and methods.
Usage
Note that the Number( ) function frequently
appears in Flash 4 .fla files that have been
converted to the Flash 5 format. For information on how datatypes are
handled when Flash 4 files are converted to Flash 5, see Section 3.4.4 in Chapter 3.
See Also
The Number class, parseFloat(
), parseInt( ); Section 3.4.2 in Chapter 3
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access