EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Number Constructor; POSITIVE_INFINITY (Number.positive_Infinity Property)

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
988 ActionScript classes
Example
This example compares the result of dividing the following values.
var posResult:Number = 1/0;
if (posResult == Number.POSITIVE_INFINITY) {
trace("posResult = "+posResult); // output: posResult = Infinity
}
var negResult:Number = -1/0;
if (negResult == Number.NEGATIVE_INFINITY) {
trace("negResult = "+negResult); // output: negResult = -Infinity
Number constructor
public Number(num:Object)
Creates a new Number object. The new Number constructor is primarily used as a placeholder.
A Number object is not the same as the
Number() function that converts a parameter to a
primitive value.
Availability: ActionScript 1.0; Flash Player 5
Parameters
num:Object - The numeric value of the Number object being created or a value to be
converted to a number. The default value is 0 if
value is not provided.
Example
The following code constructs new Number objects:
var n1:Number = new Number(3.4);
var n2:Number = new Number(-10);
See also
toString (Number.toString method), valueOf (Number.valueOf method)
POSITIVE_INFINITY (Number.POSITIVE_INFINITY
property)
public static POSITIVE_INFINITY : Number
Specifies the IEEE-754 value representing positive infinity. The value of this property is the
same as that of the constant
Infinity.
Positive infinity is a special numeric value that is returned when a mathematical operation or
function returns a value larger than can be represented.
Availability: ActionScript 1.0; Flash Player 5

Table of Contents

Related product manuals