2 Replies Latest reply on Dec 6, 2007 11:12 AM by crjcaptain

    removeMovieClip

    crjcaptain
      What I can't find a way to do is to remove a movie clip once a new frame is selected.
      Example AS:
      // ----- Popup Dialog -----\\
      this.createEmptyMovieClip("container_mc", 1);
      this.midway_mc.onRelease = function() {
      var t:MovieClip = container_mc.attachMovie("popup1", "popup1_mc", container_mc.level1);
      t._x = 410;
      t._y = 318;
      t.closer.onRelease = function() {
      t.removeMovieClip();
      };

      The above works to remove from the current frame if the user selects the closer button, but when you change frames to a new frame the movie clip remains. I tried the a/s below but it does not work. Any Ideas???

      if (frame =! "_gameroom"){
      t.removeMovieClip();
      }
      else{
      stick("_gameroom");
      };

        • 1. Re: removeMovieClip
          LukasCanoe
          try using these:
          _root["popup1_mc"].removeMovieClip(); or eval("popup1_mc").removeMovieClip().
          The life time of {t} is ended after exiting mouse action to trying to reference it that way will not work.
          Or you could try us loadMovieNum("popup1",20) and simple us unLoadMovieNum(20) to remove what ever is at depth 20 in this case popup1
          • 2. Re: removeMovieClip
            crjcaptain Level 1
            When I put that code into the action script it did not work. But that got me thinking about what flash was looking for and that was the container_mc. So I put that into the action script in the next frame and it worked.

            _root["container_mc"].removeMovieClip();

            My initial idea was to put that script in an if/else loop so in the frame, but like you said once out of the call the var is no longer available.
            Thanks for your help,
            Mike