0 Replies Latest reply on Oct 16, 2009 8:37 AM by Ecomol

    Garbage Collection Issue for Tree Component

    Ecomol

      Dear:

       

      When I created a new Tree instance dynamically by following code, and clicked any tree node randomly and then I removed it via another button, but I found this instance couldn’t be removed by GC, if I just created this tree without mouse action, it can be removed by GC.

       

      Tree Component:

      -- TreeView

      <mx:canvas>

      <mx:Tree dataProvider="{data}"  />   // data is a XML staments

      </mx:canvas>

       

       

      Create Tree:

                 public function createView(event:Event):void{

                    var view:TreeView = new TreeView ();

                    view.name="myTree";

                    addChild(view);

                    view=null;

                 }

       

      Remove Tree:

                 public function deleteView(event:Event):void{

                    var view:TreeView= TreeView( _con.getChildByName("myTree"));

                    removeChild(view);

                 }

       

       

      Could someone give me some suggestion?

       

      Thanks a lot