# How to use iconFunction

**URL:** <https://forum.kirupa.com/t/how-to-use-iconfunction/115413>\
**Category:** Uncategorized\
**Created:** [July 8, 2004, 12:48pm UTC](https://forum.kirupa.com/t/how-to-use-iconfunction/115413 "2004-07-08T12:48:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flashmatazz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/flashmatazz/32/140_2.png) [@Flashmatazz](https://forum.kirupa.com/u/Flashmatazz)\
**Post date:** [July 8, 2004, 12:48pm UTC](https://forum.kirupa.com/t/how-to-use-iconfunction/115413/1 "2004-07-08T12:48:43Z")

</div>

I’m trying to customize the listbox component in such a way that I can add icons to each item. I’m trying to use the iconFunction but obviously I’m doing something wrong.

This is what I have:

```auto

list.iconFunction = function(item){
   trace("iconFunction called");
   var rating = item.data.rating;
   if (rating=="poor") {
      return "poorIcon";
   } else if (rating=="verygood") {
      return "verygoodIcon";
   }
}
myList.addItem({label:"label 1", rating:"verygood"});
myList.addItem({label:"another label", rating:"poor"});

myList.iconFunction;

```

This doesn’t work and I’m a bit lost on how I should call this function.

Flash Help says:

> **Usage**

listInstance.iconFunction

Does anybody know how to use this?
