Extending TreeItemRenderer in Flex 2 Beta 2
Extending TreeItemRenderer to replace default icons with icons unique to each branch/leaf
[The following was created as of Flex 2, Beta 2]
Here'a a simple example of how to extend TreeItemRenderer to modify the tree items. In this example we apply a different style for branch nodes and leaf nodes. We also remove the default icons and place an image in it's place.
For my purposes, I want to have a different image in each tree item at runtime, and this is the solution I came up with. This example just places a 'branch' image for branches, and a 'leaf' image for leaf items, but it can be easily modified to do what I just described.
CustomTreeItemRenderer.mxml
View the source here
Many thanks to Joan Tan for getting me started on this!
[The following was created as of Flex 2, Beta 2]
Here'a a simple example of how to extend TreeItemRenderer to modify the tree items. In this example we apply a different style for branch nodes and leaf nodes. We also remove the default icons and place an image in it's place.
For my purposes, I want to have a different image in each tree item at runtime, and this is the solution I came up with. This example just places a 'branch' image for branches, and a 'leaf' image for leaf items, but it can be easily modified to do what I just described.
CustomTreeItemRenderer.mxml
View the source here
Many thanks to Joan Tan for getting me started on this!