5 Replies Latest reply on Jul 2, 2007 3:21 AM by Greg Dove

    removeMovieClip problem


      I have a movieclip that contains a button. This movieClip is being duplicated a number of times. The button inside the movieclip contains the code attached below. When a button is pressed i need the movieClip to unload / be removed. For some reason, probably obviouse to everyone but me I cant manage to get the movieClip to unload.

      Any advice / hacks at my code very welcome.



        • 1. Re: removeMovieClip problem
          Greg Dove Level 4
          Was the parent clip put on stage by actionscript or by using flash authoring tool?

          And/or are you using some of the v2 components?

          If so you may need to use swapDepths or the DepthManager (if using v2 components).

          livedocs excerpt:

          This method does not remove a movie clip assigned to a negative depth value. Movie clips created in the authoring tool are assigned negative depth values by default. To remove a movie clip that is assigned to a negative depth value, first use the MovieClip.swapDepths() method to move the movie clip to a positive depth value.

          Note: If you are using version 2 components, do not use this method. If you place a version 2 component either on the Stage or in the Library, the getNextHighestDepth() method can sometimes return depth 1048676, which is outside the valid range. If you are using version 2 components, you should always use the version 2 components DepthManager class

          source: http://livedocs.adobe.com/flash/9.0/main/00001965.html#wp394974
          • 2. Re: removeMovieClip problem
            BarryGee Level 1

            I already read the live docs thats why i posted here. The origional movieclip is placed on the stage (not using actionScript), this movieClip is then duplicated (using actionScript).

            • 3. removeMovieClip problem
              Greg Dove Level 4
              Hi Barry.

              I think you will find its related to the problem.

              try changing your code to something like this:

              obtnBTN.onRelease = function() {
              this._parent.swapDepths(5000); //some positive number


              trace("should have unloaded");

              • 4. Re: removeMovieClip problem
                BarryGee Level 1
                Hi GWD.

                Thanks thats working fine. I was a little confused as i have a seperate button on level 0 that removes all of the duplicated movieClips and i dont have to swap depths when using that button. Anyhow this works fine so thanks again.

                • 5. Re: removeMovieClip problem
                  Greg Dove Level 4
                  No problems... and you're welcome.