Array.sortOn() 283
}
}
trace ("Unsorted:");
trace (passwords.join());
passwords.sort(order);
trace ("Sorted:");
trace (passwords.join());
The Output panel displays the following results:
Unsorted:
mom:glam,ana:ring,jay:mag,anne:home,regina:silly
Sorted:
ana:ring,anne:home,jay:mag,mom:glam,regina:silly
See also
| (bitwise OR)
, Array.sortOn()
Array.sortOn()
Availability
Flash Player 6; additional capabilities added in Flash Player 7.
Usage
my_array.sortOn("fieldName" )
my_array.sortOn("fieldName", option | option |... )
my_array.sortOn( [ "fieldName" , "fieldName" , ... ] )
my_array.sortOn( [ "fieldName" , "fieldName" , ... ] , option | option |... )
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 strings, 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.UNIQUE
• 8 or Array.RETURNINDEXEDARRAY
• 16 or Array.NUMERIC
Each of these options in discussed in more detail in “Description,” below.