6 Replies Latest reply on May 13, 2008 9:03 AM by rziller

    removeMovieClip not working

    jp311 Level 1
      Can anyone tell me why this movieClip is not being removed from the code below? Thanks!

        • 1. Re: removeMovieClip not working
          Ned Murphy Adobe Community Professional & MVP
          I always have a problem with this, but eventually find the right object to address. Since you attached the movie to blip, try:

          blip.removeMovieClip();

          If that doesn't work, pick newName and give that a shot.

          If that doesn't work, then try using a _parent reference. It kinda depends on where "this" is relative to the rest of what you're dealing with.

          If someone else does have a firm grip on this, then by all means, ring in.
          • 2. Re: removeMovieClip not working
            Rothrock Level 5
            It is a most likely a scoping issue and a case of how removeMovieClip() works. It will only work on clips that are dynamically created by code, so is waBlip_mc dynamically created or is it runtime created?

            Because that is the movie you are trying to remove. Inside the event handler "this" refers to the object you have attached the event handler to. So is that right, or are you trying to remove waPopup_mc?

            Finally the next problem might be one of depths. If you are using any components your this.getNextHighestDepth() might be returning a really high deapth (1048575 or above) that won't allow dynamically created clips to be removed.

            I also see a problem with that depth assignment in that the scope of your function most likely isn't what you think it is. Inside the onRollOver event handler function your scope is the item that the handler is attached to, i.e. waBlip_mc. You can see that by adding a trace:

            trace("Current scope is: "+this);

            But once the handler calls another function, in this case showPup(), the scope changes to where that function is defined. So if you add a trace inside that function you will get a different scope, most likely _level0 or whatever timeline all this code is defined on.

            So I'm not exactly sure, but some combination of those things is most likely the problem.
            • 3. Re: removeMovieClip not working
              jp311 Level 1
              I've tried all of these. This is driving me nutz. I can't figure it out. Grrrr!
              • 4. Re: removeMovieClip not working
                jp311 Level 1
                I got it! Look below to see what I did. Thanks to everyone that helped out on this.
                • 5. Re: removeMovieClip not working
                  Rothrock Level 5
                  What do you mean you've tried all of these? So what depth are you assigning them too?
                  • 6. Re: removeMovieClip not working
                    rziller
                    Do you use any components in your movie?
                    That causes the getNextHighestDepth() function to return really high depth values, that are out of range for the removeMovieClip() function to remove.

                    You should use the DepthManager component in this case. Just look it up in the help files of Flash.

                    As a workaround, if you don't want to use the DepthManager, you can do a swapDepths() on the clip and swap it to a layer that is in range.