Sort (Array.sort Method) - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

sort (Array.sort method)

public sort([compareFunction:Object], [options:Number]) : Array
Sorts the elements in an array. Flash sorts according to Unicode values. (ASCII is a subset of
Unicode.)
By default,
.
Array
sort()
Sorting is case-sensitive (Z precedes a).
Sorting is ascending (a precedes b).
The array is modified to reflect the sort order; multiple elements that have identical sort
fields are placed consecutively in the sorted array in no particular order.
Numeric fields are sorted as if they were strings, so 100 precedes 99, because "1" is a lower
string value than "9".
If you want to sort an array by using settings that deviate from the default settings, you can
either use one of the sorting options described in the entry for the
can create your own custom function to do the sorting. If you create a custom function, you
can use it by calling the
parameter (
compareFunction
Availability: ActionScript 1.0; Flash Lite 2.0 - Array sorting option added in Flash Player 7.
Parameters
compareFunction:Object
order of elements in an array. Given the elements A and B, the result of
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
[optional] - One or more numbers or names of defined constants, separated
options:Number
by the
(bitwise OR) operator, that change the behavior of the sort from the default. The
|
following values are acceptable for the
Array.CASEINSENSITIVE
Array.DESCENDING
Array.UNIQUESORT
Array.RETURNINDEXEDARRAY
or 16
Array.NUMERIC
For more information about this parameter, see the
260
ActionScript classes
works as described in the following list:
method, using the name of your custom function as the first
sort()
).
[optional] - A comparison function used to determine the sorting
options
or 1
or 2
or 4
or 8
options
parameter:
Array.sortOn()
parameter or you
compareFunction
method.

Advertisement

Table of Contents
loading

Table of Contents