List.sortItems()

Availability

Flash Player 6.0.79.

Edition

Flash MX 2004.

Usage

listInstance.sortItems(compareFunc)

Parameters

compareFunc A reference to a function. This function is used to compare two items to determine their sort order.

For more information, see Array.sort() in ActionScript Dictionary Help.

Returns

The index at which the item was added.

Description

Method; sorts the items in the list according to the compareFunc parameter.

Example

The following example sorts the items based on 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()