1 Reply Latest reply on Oct 13, 2010 11:50 AM by Flex harUI

    Flex Tree multiple item renderers


      Hello All,


      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)
                      return nullItemRenderer;
                  var classFactory:ClassFactory;
                  if(data is AssetResult)
                      classFactory = new ClassFactory(AssetSearchItemRenderer);
                  if(data is SegmentResult)
                      classFactory = new ClassFactory(SegmentSearchItemRenderer);
                  return classFactory;