Description
Method; sorts the items in the combo box according to the specified compare function or
according to the specified sort options.
Example
This example sorts according to uppercase labels. The items
and
are passed to the function
a
b
and contain
and
fields:
label
data
myComboBox.sortItems(upperCaseFunc);
function upperCaseFunc(a,b){
return a.label.toUpperCase() > b.label.toUpperCase();
}
The following example uses the
function defined above, along with the
upperCaseFunc()
parameter to sort the elements of a ComboBox instance named
:
optionsFlag
myComboBox
myComboBox.addItem("Mercury");
myComboBox.addItem("Venus");
myComboBox.addItem("Earth");
myComboBox.addItem("planet");
myComboBox.sortItems(upperCaseFunc, Array.DESCENDING);
// The resulting sort order of myComboBox will be:
// Venus
// planet
// Mercury
// Earth
ComboBox.sortItemsBy()
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
comboBoxInstance.sortItemsBy(fieldName, order [optionsFlag])
Parameters
A string that specifies the name of the field to use for sorting. This value is
fieldName
usually
or
.
"label"
"data"
A string that specifies whether to sort the items in ascending order (
) or
order
"ASC"
descending order (
).
"DESC"
202
ComboBox component
Need help?
Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?
Questions and answers