# Icon in listbox

**URL:** https://forum.kirupa.com/t/icon-in-listbox/117893
**Category:** Uncategorized
**Created:** [July 31, 2004, 1:20pm UTC](https://forum.kirupa.com/t/icon-in-listbox/117893 "2004-07-31T13:20:42Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![saschart](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@saschart](https://forum.kirupa.com/u/saschart)
#### Post date: [July 31, 2004, 1:20pm UTC](https://forum.kirupa.com/t/icon-in-listbox/117893/1 "2004-07-31T13:20:42Z")

</div>

Hello,

How can I put icon in list box  
I tried this.my\_list.addItem(this.data, iconMale); where iconMale is a movie with this linkage

I used the new listbox component with code for icon in the FCFSelectableItem:

_// EXTEND this method to change the rendering of the content in an item (multiple labels, icons, etc)  
FCFSelectableItemClass.prototype.displayContent = function(itmObj, selected)  
{  
//:: Begin choosing the text to display, by introspecting the object a little.  
var tmpLabel = “”;  
if (itmObj.label!=undefined) {  
tmpLabel = itmObj.label;  
} else {  
if (typeof(itmObj)==“object”) {  
for (var i in itmObj) {  
if (i!=“ **ID** ”) {  
tmpLabel = itmObj_ + ", " + tmpLabel;  
}  
}  
tmpLabel = tmpLabel.substring(0,tmpLabel.length-2);\*

- } else {  
tmpLabel = itmObj;  
}  
}  
//:: End choosing text to display; display it.  
if (this.fLabel\_mc.labelField.text!=tmpLabel) {  
this.fLabel\_mc.setLabel(tmpLabel);  
}

// color the label.  
var clr = (selected) ? this.controller.styleTable.textSelected.value : this.controller.styleTable.textColor.value;  
if (clr==undefined) {  
clr = (selected) ? 0xffffff : 0x000000;  
}  
this.fLabel\_mc.setColor(clr);\*  
_}_

Where is the problem ?

---

<div class="post-metadata">

### Author: ![El\_Phantom](https://avatars.discourse-cdn.com/v4/letter/e/d6d6ee/32.png) [@El\_Phantom](https://forum.kirupa.com/u/El_Phantom)
#### Post date: [July 31, 2004, 10:34pm UTC](https://forum.kirupa.com/t/icon-in-listbox/117893/2 "2004-07-31T22:34:01Z")

</div>

I think you might have to use the cellRenderer API to do that. Do a google search, there are some resources out there but not many. I’m not sure that this is the case but it’s a hunch. CellRenderer API is a little confusing if you aren’t used to external AS classes, but there are some resources to be found on the internet.

–EP
