May 2001
Intermediate to advanced
720 pages
23h 24m
English
Number.MAX_VALUE Property — the largest representable positive number in ActionScript
Flash 5
Number.MAX_VALUE
Read-only
The MAX_VALUE property stores the largest
representable positive number in ActionScript
(1.7976931348623157e+308). It is convenient when you’d like 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.
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 (thisValue in myArray) {
if (myArray[thisValue] < minVal) {
minVal = myArray[thisValue];
}
}
trace ("The minimum value is " + minVal);
Number.MIN_VALUE;
Number.POSITIVE_INFINITY; Section 4.3.3 in Chapter 4
Read now
Unlock full access