Sort ComboBox
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="initData()">
<mx:Script>
import mx.collections.*;
public var myArray:Array = ["B", "C", "D", "E", "F", "A"];
[Bindable]
public var myAC:ArrayCollection;
public function initData():void {
myAC = new ArrayCollection(myArray);
}
public function sortAC():void {
var sortA:Sort = new Sort();
sortA.fields=[new SortField("area", true, true),
new SortField("label")];
myAC.sort=sortA;
myAC.refresh();
}
</mx:Script>
<mx:ComboBox initialize="sortAC()" id="myCB" rowCount="7" dataProvider="{myAC}" />
<mx:TextArea id="ta1" height="75" width="300" />
</mx:Application>
Related examples in the same category