Mega Code Archive

 
Categories / Flex / Components
 

Using a label function with one-column List-based components

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     backgroundColor="white">     <mx:Script>                  import mx.collections.ArrayCollection;         import mx.events.ListEvent;         import mx.controls.Alert;         public var myAC:ArrayCollection = new ArrayCollection([             {name:"A", email:"a@domain.com"},             {name:"B", email:"b@domain.com"}]);         public function handleClick(evt:ListEvent):void         {             Alert.show(evt.rowIndex + " / col:" + evt.columnIndex + "." + "for " + evt.currentTarget.selectedItem.name);         }         public function fullName(rowItem:Object):String         {             return rowItem.firstName + ' ' + rowItem.lastName;         }            </mx:Script>     <mx:List dataProvider="{myAC}" labelFunction="fullName" /> </mx:Application>