So I was having a problem dynamically creating icons for my Tree. What I have is an xml file that gets loaded up and has a tree created for it. Each item in the xml(tree node) has some information about it. One piece of info is the image that should be used for the node. As you know you can supply the iconFunction to the Tree. The problem is you can not just return a new Image with the source assigned to it. What you really need to return is a Class that is going to be used. So in searching around on the net I found this by Ben Stucki’s site. This is a great utility that allows you to have an image data created for you. It also keeps track of what UIComponent the data goes with by using a dictionary. However this is also the one problem for it as well. I don’t necessarily want to associate a UIComponent with the image data. In this case I just want the string value (link to my image) to be the item that is associated with the data. All that needs to be done to the IconUtility class is to change the first argument to * instead of UIComponent. Then you will be able to use this for your Tree or other ListBase iconFunction.
Flex Gig
Mostly flex related topics
