![MACROMEDIA Flash Lite 2 Скачать руководство пользователя страница 260](http://html1.mh-extra.com/html/macromedia/flash-lite-2/flash-lite-2_reference_687553260.webp)
260
ActionScript classes
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()
works as described in the following list:
■
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
options
parameter or you
can create your own custom function to do the sorting. If you create a custom function, you
can use it by calling the
sort()
method, using the name of your custom function as the first
parameter (
compareFunction
).
Availability:
ActionScript 1.0; Flash Lite 2.0 - 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.
Содержание Flash Lite 2
Страница 1: ...Flash Lite 2 x ActionScript Language Reference...
Страница 22: ...22 Contents...
Страница 244: ...244 ActionScript language elements...
Страница 760: ...760 ActionScript classes...