I'm trying to create a tree that has different item renderers for whatever seeminly pops into the tree.
Currently I have a new Tree class that has this method, but this tends to cause memory leaks or multiple unused item renderers... found it on some website. Any ideas how to get around this?
public class SearchTree extends Tree
public function SearchTree()
override public function getItemRendererFactory(data:Object):IFactory
if(data == null)
if(data is AssetResult)
classFactory = new ClassFactory(AssetSearchItemRenderer);
if(data is SegmentResult)
classFactory = new ClassFactory(SegmentSearchItemRenderer);
You could have one renderer that changes its children based on the data.