Array.sortOn()
251
Array.sortOn()
Availability
Flash Player 6; additional capabilities added in Flash Player 7.
Usage
my_array
.sortOn("
fieldName
"
:String
)
: Array
my_array
.sortOn("
fieldName
"
:String
,
option:Number
|
option
|... )
: Array
my_array
.sortOn( [ "
fieldName
" , "
fieldName
" , ... ]
:Array
)
: Array
my_array
.sortOn( [ "
fieldName
" , "
fieldName
" , ... ]
:Array
,
option:Number
|
option
|... )
: Array
Note:
Where brackets ([]) are shown, you must include them in the code; that is, the brackets don’t
represent optional parameters.
Parameters
fieldName
A string that identifies a field (in an element of the Array) to be used as the
sort value.
option
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
option
:
•
1 or
Array.CASEINSENSITIVE
•
2 or
Array.DESCENDING
•
4 or
Array.UNIQUESORT
•
8 or
Array.RETURNINDEXEDARRAY
•
16 or
Array.NUMERIC
For more information about each option, see
“Description” on page 251
.
Returns
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
option
, 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
option
, 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.
Description
Method; sorts the elements in an array according to one or more fields in the array. If you pass
multiple
fieldName
parameters, the first field represents the primary sort field, the second
represents the next sort field, and so on. Flash sorts according to Unicode values. (ASCII is a
subset of Unicode.) If either of the elements being compared does not contain the field specified
in the
fieldName
parameter, the field is assumed to be
undefined
, and the elements are placed
consecutively in the sorted array in no particular order.
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...