Combine label and data for List item
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
public function myLabelFunc(item:Object):String {
return item.data + ", " + item.label;
}
</mx:Script>
<mx:ArrayCollection id="myData">
<mx:source>
<mx:Object label="A" data="aa" />
<mx:Object label="B" data="bb" />
<mx:Object label="C" data="cc" />
</mx:source>
</mx:ArrayCollection>
<mx:List dataProvider="{myData}" labelFunction="myLabelFunc" />
</mx:Application>
Related examples in the same category