0 Replies Latest reply on Jul 7, 2006 5:30 AM by m.axl.o

    * How about flash play 8 Garbage Collector working?

    m.axl.o
      Hi, I need to add some Image controls dynamically, yes,the number of those are unpredictable.
      My code to create them like this:


      quote:

      public function addImg(name:String, x:Number, y:Number):void
      {
      var sm1:Image = new Image();
      sm1.source = "imgs/down_medium.gif";
      sm1.name = name;
      sm1.x = x;
      sm1.y = y;
      this.addChild(sm1);
      }



      Then, it appeared in my application. if I add numbers of Image in my stage, they eat my memory crazily.
      so I want to kill some Image which is not in use, but I crashed.

      An Image named "img4kill" in stage, it's index in this.getChildren() is4, and it holds a image which size is about 230K.
      I tried to kill it like this:


      quote:

      this.removeChildAt(4);




      yes, it's remove from the stage in faith, but I watched the memory that the browser using, before and after killing it.
      I found the memory it takes is not released.
      How can I kill it from both the stage and memory ? I tried the global function "delete" ,but failed too.
      I know that flash play 8.5 and later use a powerfull GC(garbage collector), but in the sample above, it dose't work for me.

      who can save me from this mud layer?any ideas?
      thanks a lot .
      (sorry about my ugly english)
      ka1pa@yahoo.com.cn