3 Replies Latest reply on Jul 25, 2006 10:14 PM by scriptrookie

# swapDepth help

I'm trying to get a swapDepth to work on rollOver, but am having trouble. I've never used swapDepth before so this is my first venture into it and trying to make something rather simple. An example of something similar is the thumbnails on www.mlb.com. Can anybody give me any direction on this? As of now I have five different objects that I want to swapDepth wish but may add more after I figure this out. Any help is appreciated! I realize it's something rather simple that is eluding me right now it seems.
• ###### 1. Re: swapDepth help
swapDepths() kind of has a bad name. Because it does two things. The first is take a movie and another movie and swap them:

movie1.swapDepths(movie2);

Will take the depths of the two movies and swap them. But there is another way to use it as well.

movie1.swapDepths(1000);

Will put movie1 at a depth of 1000 (remember higher numbers mean more on top.

Another confusion for a lot of folks new to this is that the hierarchy starts over again for each branch of the tree.

Imagine a tall office building. Floor 50 will always be above floor 49. So even though something is 8 feet above the carpet on floor 49, it will not be higher than something 1 foot above the carpet on floor 50.

So if your five different clips are in different parents that might be part of the problem.

Finally there can be complications with how timeline objects and actionscript manipulated objects interact with depths. Check out the following tutorial to learn much more than you ever wanted to know about depths in Flash.

http://www.kirupa.com/developer/actionscript/depths.htm

PS: You didn't really tell us what the problem is. So if what I've mentioned doesn't hit the mark, you will have to slap mark yourself. :) (I mean, post back.)
• ###### 2. Re: swapDepth help
Thanks! I'm looking over that tutorial now. My main problem was in understanding how to get swapDepth to work because all of the tutorials I found took a different approach to it and I couldn't figure out how to apply it to the way in which I want to use it. I just wanted something nice and simple that would allow me to swap depths between multiple movie clips on rollover. This tutorial looks pretty thorough though, so hopefully it helps!
• ###### 3. Re: swapDepth help
try this one too, something that applies to that tutorial...

http://www.kirupa.com/developer/actionscript/swapdepth.htm