Number.MAX_VALUE Property

ActionScript for Flash MX: The Definitive Guide, 2nd Edition
By Colin Moock
Chapter 18.  ActionScript Language Reference
Number.MAX_VALUE Property Flash 5

the largest representable positive number in ActionScript read-only
Number.MAX_VALUE

Description

The MAX_VALUE property returns the largest representable positive number in ActionScript (1.79769313486231e+308). It is convenient when you want to start with a very large value, as shown in the following Example. Any number greater than MAX_VALUE can't be represented by ActionScript and is therefore considered to be POSITIVE_INFINITY (i.e., Infinity).

Example

Here we are looking for a minimum value in an array. We initialize the minVal variable to MAX_VALUE, knowing that any subsequent value will be less than it:

var myArray = [-10, 12, 99]; var minVal = Number.MAX_VALUE; for (var thisValue in myArray) {   if (myArray[thisValue] < minVal) {     minVal = myArray[thisValue];   } } trace ("The minimum value is " + minVal);

See Also

Infinity, Number.MIN_VALUE, Number.POSITIVE_INFINITY; Section 4.3.3



    ActionScript for Flash MX. The Definitive Guide
    ActionScript for Flash MX: The Definitive Guide, Second Edition
    ISBN: 059600396X
    EAN: 2147483647
    Year: 2002
    Pages: 780
    Authors: Colin Moock

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net