5 Replies Latest reply on May 14, 2007 6:38 AM by kglad

    swapDepths method

    Koala_No.1
      I created a button and 2 movie clips. Every time when the button is clicked, the two movie clips change depth level, so that I can see the color changes. It worked fine.

      swap_btn.onRelease = function() {
      bgBlue_mc.swapDepths(bgYellow_mc);
      };

      After I loaded swf files onto the movie clips, I couldn't see see any changes of the depth level any more. What is wrong with that? Is there a way to solve this problem.
        • 1. Re: swapDepths method
          kglad Adobe Community Professional & MVP
          what do you mean by "... I loaded swf files onto the movie clips..."?
          • 2. Re: swapDepths method
            Koala_No.1 Level 1
            I meant that use the loadMovie function to load a SWF file into the movie clip I created earlier. thank you
            • 3. Re: swapDepths method
              kglad Adobe Community Professional & MVP
              those two movieclips are probably swapping depths but you may not see what you expect: they can't be positioned above a movieclip that's above their parent or below a movieclip that's below their parent. but they should be changing depth relative to each other.

              to confirm use the following and post the trace results:
              • 4. Re: swapDepths method
                Koala_No.1 Level 1
                thank you kglad! As you said the two movie clips do swap depths, but not as I expected. Is there a way to solve this problem? Rather than using swapDepths method, what else I could use to make two movie clips swap position? thank you!
                • 5. Re: swapDepths method
                  kglad Adobe Community Professional & MVP
                  you may be able to swap depths of the parent AND those two (just as you're doing now) or you may need to load them into different parent movieclips (and swap depths of their parents). it depends upon what you're trying to do.

                  if one of those is to be moved above a movieclip that's above the parent and the other is to be moved below that movieclip, then they'll have to be loaded into different parents.

                  otherwise, you can use your current setup and move the parent where you need (by adding bgBlue_mc._parent.swapDepths() with no need to do this for bgYellow_mc, too) and use your current code to move bgBlue_mc and bgYellow_mc relative to each other.