Using ArrayCollection to handle complex data
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
creationComplete="createAC()">
<mx:Script>
import mx.collections.ArrayCollection;
[Bindable]
public var myAC_AS:ArrayCollection = new ArrayCollection(
[{label:"A", data:"AA"},
{label:"B", data:"BB"},
{label:"C", data:"CC"}]);
public function createAC():void
{
myAC_AS = new ArrayCollection(
[{label:"A", data:"AA"},
{label:"B", data:"BB"},
{label:"C", data:"CC"}]);
}
</mx:Script>
<mx:ComboBox id="myCombo" dataProvider="{myAC_AS}" change="myTxt.text = myCombo.selectedItem.data" />
<mx:TextInput id="myTxt" />
</mx:Application>
Related examples in the same category