I wanna add icons to my tree. It takes an external XML as its data provider. The structure of the XML is something like this:
Here i wanna assing different icons to different tags(A, B, C, D)
I know that by using defaultLeafIcon property in mx:Tree we can set an icon to the leaves. But i wanna set different icons to different nodes.
As u see in the above example, some leaves are C, while some are D. I should able to differentiate between them as well.
You could try using the iconFunction property to specify a method to determine the icon:
A user-supplied function to run on each item to determine its icon. By default the list does not try to display icons with the text in the rows. However, by specifying an icon function, you can specify a Class for a graphic that will be created and displayed as an icon in the row. This property is ignored by DataGrid.
The iconFunction takes a single argument which is the item in the data provider and returns a Class.
The default value is
This property can be used as the source for data binding.
public function get iconFunction():Function
public function set iconFunction(value:Function):void
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
Flex / AIR Development, Training, and Support Services