View comments | RSS feed

Number


Object
    |
    +-Number

public class Number
extends Object

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.

The properties of the Number class 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;

Availability: ActionScript 1.0; Flash Player 5 - (became a native object in Flash Player 6, which improved performance significantly).

Property summary

Modifiers

Property

Description

static

MAX_VALUE:Number

The largest representable number (double-precision IEEE-754).

static

MIN_VALUE:Number

The smallest representable number (double-precision IEEE-754).

static

NaN:Number

The IEEE-754 value representing Not A Number (NaN).

static

NEGATIVE_INFINITY:Number

Specifies the IEEE-754 value representing negative infinity.

static

POSITIVE_INFINITY:Number

Specifies the IEEE-754 value representing positive infinity.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Constructor summary

Signature

Description

Number(num:Object)

Creates a new Number object.

Method summary

Modifiers

Signature

Description

 

toString(radix:Number) : String

Returns the string representation of the specified Number object (myNumber).

 

valueOf() : Number

Returns the primitive value type of the specified Number object.

Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

Comments


No screen name said on Mar 10, 2006 at 1:45 AM :
var aaa:Number = Number(81.9);
var bbb:Number = Number(81.7);
var ccc:Number = aaa - bbb;

trace(ccc);

the result is 0.200000000000003

i want that result is 0.2
shohon said on Jun 25, 2007 at 4:12 PM :
I have the same issue as above --
How do you set the precision of a Number?

Thanks in advance,
-shohon

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002569.html