Use iconFunction to determine the icon to display
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
[Embed(source="logo.jpg")]
public var imageIcon1:Class;
[Embed(source="logo.jpg")]
public var normalSymbol:Class;
private var myData: Array;
private function initList():void {
myData = [{Artist:'A', Album:'AA',Price:1.99},
{Artist:'B', Album:'BB',Price:1.99},
{Artist:'C', Album:'CC',Price:5.99}];
list1.dataProvider = myData;
}
private function myiconfunction(item:Object):Class{
var type:String = item.Artist;
if (type == "A") {
return imageIcon1;
}
return normalSymbol;
}
</mx:Script>
<mx:VBox>
<mx:List id="list1" initialize="initList()" labelField="Artist" iconFunction="myiconfunction" />
</mx:VBox>
</mx:Application>
Related examples in the same category