3 Replies Latest reply on Aug 6, 2007 10:18 PM by kglad

    Removing clips from the timeline in as 3.0

    TimDiggle2000
      Try this test:

      Creat a new Flash movie with 2 bank keyframes.

      Draw a rectangle on the first frame, convert it to a movieclip and give it an instance name of testSym

      Add this code to the first frame:

      ////////////////////////////


      removeChild(testSym);

      testSym = null;

      /////////////////////////


      and then this code to the second frame:

      //////////////////////


      trace ("FORCING GC");
      try {
      new LocalConnection().connect('foo');
      new LocalConnection().connect('foo');
      } catch (e:*) {}
      stop();

      // this forces the garbage collector but is not recommended for published products
      ///////////////////////

      give the rectangle movie clip 2 blank keyframes too. Put this code in the first frame:

      ///////////////////

      trace("I'm still here");

      /////////////////////

      and this code in the second:

      ///////////////////

      gotoAndPlay(1);

      ///////////////////

      Now run the movie - I assumed that the clip would be marked for garbage collection and collected by the forced collect, but it still persists - presumably because it was put statically on the timeline?

      Is there any way around this? Surely there must be a way to remove movie clips that have been placed statically on the timeline at design time rather than adding everything using code? Can anyone help?