03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Number constructor<br />

public Number(num:Object)<br />

Creates a new Number object. The new Number constructor is primarily used as a placeholder.<br />

A Number object is not the same as the Number() function that converts a parameter to a<br />

primitive value.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Parameters<br />

num:Object - The numeric value of the Number object being created or a value to be<br />

converted to a number. The default value is 0 if value is not provided.<br />

Example<br />

The following code constructs new Number objects:<br />

var n1:Number = new Number(3.4);<br />

var n2:Number = new Number(-10);<br />

See also<br />

toString (Number.toString method), valueOf (Number.valueOf method)<br />

POSITIVE_INFINITY (Number.POSITIVE_INFINITY<br />

property)<br />

public static POSITIVE_INFINITY : Number<br />

Specifies the IEEE-754 value representing positive infinity. The value of this property is the<br />

same as that of the constant Infinity.<br />

Positive infinity is a special numeric value that is returned when a mathematical operation or<br />

function returns a value larger than can be represented.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Example<br />

This example compares the result of dividing the following values.<br />

var posResult:Number = 1/0;<br />

if (posResult == Number.POSITIVE_INFINITY) {<br />

trace("posResult = "+posResult); // output: posResult = Infinity<br />

}<br />

var negResult:Number = -1/0;<br />

if (negResult == Number.NEGATIVE_INFINITY) {<br />

trace("negResult = "+negResult); // output: negResult = -Infinity<br />

1002 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!