User Guide

List component 481
Description
Method; sorts the items in the list by using the function specified in the compareFunc parameter.
Example
The following example sorts the items according to uppercase labels. Note that the a and b
parameters that are passed to the function are items that have
label and data properties.
myList.sortItems(upperCaseFunc);
function upperCaseFunc(a,b){
return a.label.toUpperCase() > b.label.toUpperCase();
}
See also
List.sortItemsBy()
List.sortItemsBy()
Availability
Flash Player 6 (6.0 79.0).
Edition
Flash MX 2004.
Usage
myList.sortItemsBy(fieldName, optionsFlag)
myList.sortItemsBy(fieldName, order)
Parameters
fieldName
A string that specifies the name of the field to use for sorting. This value is usually
"label" or "data".
order A string that specifies whether to sort the items in ascending order ("ASC") or descending
order (
"DESC").
optionsFlag Lets you perform multiple sorts of different types on a single array without
having to replicate the entire array or resort it repeatedly.
The following are possible values for
optionsFlag:
Array.DESCENDING, which sorts from highest to lowest.
Array.CASEINSENSITIVE, which sorts without regard to case.
Array.NUMERIC, which sorts numerically if the two elements being compared are numbers. If
they arent numbers, use a string comparison (which can be case-insensitive if that flag is
specified).
Array.UNIQUESORT, which returns an error code (0) instead of a sorted array if two objects in
the array are identical or have identical sort fields.