User Guide
650 Chapter 2: ActionScript Language Reference
Number class
Availability
Flash Player 5 (became a native object in Flash Player 6, which improved
performance significantly).
Description
The Number class is a simple wrapper object for the Number data type. You can manipulate
primitive numeric values by using the methods and properties associated with the Number class.
This class is identical to the JavaScript Number class.
To call the Number class methods, you must first use the constructor to create an instance of the
Number class. The properties of the Number class, however, are static, which means you do not
need an object to use them, so you do not need to use the constructor.
The following example calls the
toString() method of the Number class, which returns the
string
1234:
var myNumber:Number = new Number(1234);
myNumber.toString();
The following example assigns the value of the MIN_VALUE property to a variable declared without
the use of the constructor:
var smallest:Number = Number.MIN_VALUE;
Method summary for the Number class
Property summary for the Number class
The properties in the following table are constants:
Method Description
Number.toString()
Returns the string representation of a Number object.
Number.valueOf()
Returns the primitive value of a Number object.
Property Description
Number.MAX_VALUE
The largest representable number (double-precision IEEE-754). This
number is approximately 1.79E+308.
Number.MIN_VALUE
The smallest representable number (double-precision IEEE-754).
This number is approximately 5e-324.
Number.NaN
The value for Not a Number (NaN).
Number.NEGATIVE_INFINITY
The value for negative infinity.
Number.POSITIVE_INFINITY
The value for positive infinity. This value is the same as the global
variable Infinity.
CHAPTER 2
ActionScript Language Reference