Use ActionScript to declare and create the ArrayCollection object

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="initData()">
<mx:Script>
import mx.collections.*;
[Bindable]
public var stateArray:ArrayCollection;
public function initData():void {
stateArray=new ArrayCollection(
[{label:"AL", data:"aL"},
{label:"AK", data:"AK"},
{label:"AR", data:"AR"}]);
}
</mx:Script>
<mx:ComboBox id="myComboBox" dataProvider="{stateArray}" />
</mx:Application>
Related examples in the same category