Mega Code Archive

 
Categories / Flex / Components
 

Use labelFunction to provide label text for ComboBox

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="500"     height="600">     <mx:Script>                  import mx.events.*;         import mx.collections.*;         public function myLabelFunc(item:Object):String {             return item.first + " " + item.last;         }            </mx:Script>     <mx:ArrayCollection id="ac">         <mx:source>             <mx:Object first="A" last="Q" email="a@m.com" />             <mx:Object first="B" last="W" email="b@m.com" />             <mx:Object first="C" last="E" email="c@m.com" />         </mx:source>     </mx:ArrayCollection>     <mx:ComboBox id="cb" dataProvider="{ac}" labelFunction="myLabelFunc" /> </mx:Application>