1 Reply Latest reply on Sep 19, 2007 7:26 PM by miquael

    how to have an MC remove itself

    miquael Level 1
      Okay, I've done things like this a few times, and yet I've ran around every way that I can see possibly doing this without success:

      I load an MC dynamically from the library ("WIN_ABOUT"). The MC has a few buttons (MCs) within it, one of which is intended to delete the entire MC from the stage. Here's a few ways that I tried it:

      b_close.onRelease = function () {
      removeMovieClip(_root.WIN_ABOUT);
      }

      or?

      b_close.onRelease = function () {
      removeMovieClip(this._parent.WIN_ABOUT);
      }

      or?

      b_close.onRelease = function () {
      this.removeMovieClip();
      }

      or?

      b_close.onRelease = function () {
      this._parent.removeMovieClip(WIN_ABOUT);
      }

      Nothing seems to work. And I know this is a simple one!
        • 1. Re: how to have an MC remove itself
          miquael Level 1
          Silly me! I'd already asked this question before. Here is the answer that was given to me:

          this.removeMovieClip() would work if your movieclip were at a removable depth. because you're having trouble i infer that your code is attached to a movieclip created in the authoring environment is therefore at depth -16000 or so.

          removable depths are between 0 and 2^^20. to remedy use swapDepths() to move your movieclip to a removable depth and then execute your this.removeMovieClip().