User Guide

Array 257
Availability: ActionScript 1.0; Flash Player 5 - Array sorting option added in Flash Player 7.
Parameters
compareFunction:Object [optional] - A comparison function used to determine the sorting
order of elements in an array. Given the elements A and B, the result of
compareFunction
can have one of the following three values:
-1, if A should appear before B in the sorted sequence
0, if A equals B
1, if A should appear after B in the sorted sequence
options:Number [optional] - One or more numbers or names of defined constants, separated
by the
| (bitwise OR) operator, that change the behavior of the sort from the default. The
following values are acceptable for the
options parameter:
Array.CASEINSENSITIVE or 1
Array.DESCENDING or 2
Array.UNIQUESORT or 4
Array.RETURNINDEXEDARRAY or 8
Array.NUMERIC or 16
For more information about this parameter, see the
Array.sortOn() method.
Returns
Array - The return value depends on whether you pass any parameters, as described in the
following list:
If you specify a value of 4 or Array.UNIQUESORT for the options parameter and two or
more elements being sorted have identical sort fields, Flash returns a value of 0 and does
not modify the array.
If you specify a value of 8 or Array.RETURNINDEXEDARRAY for the options parameter,
Flash returns an array that reflects the results of the sort and does not modify the array.
Otherwise, Flash returns nothing and modifies the array to reflect the sort order.
NOTE
Array.sort() is defined in ECMA-262, but the array sorting options introduced in Flash
Player 7 are Flash-specific extensions to the ECMA-262 specification