Set a labelFunction for a Control
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal">
<mx:ComboBox dataProvider="{myDP}" labelFunction="getFullName"/>
<mx:Script>
import mx.collections.ArrayCollection;
[Bindable]
private var myDP:ArrayCollection = new ArrayCollection([{id:1,fName:"A", lName:"C"},
{id:2, fName:"B", lName:"D"}]);
private function getFullName(item:Object):String{
return item.fName + " " + item.lName;
}
</mx:Script>
</mx:Application>
Related examples in the same category