plasticonoband,
[quoted text, click to view] > I am trying to have the stacking order of several movie clips change
> with an onRollOver. Each movie clip needs to appear on top when
> a rollover occures on its corresponding button.
Okay. You'll be happy ... this one isn't too hard.
[quoted text, click to view] > Can someone tell me if I'm on the right track? If not, can you clue me
> in on how to do this?
btn102.onRollOver = function():Void {
var nDepth:Number = mc102.getNextHighestDepth();
}
Assuming btn102 is either a button or movie clip, you have correctly
assigned a function to that instance's onRollOver event handler. So far, so
good. Whenever this instance is rolled over, a certain set of instructions
should occur. Let's see what you've told the function to do.
You have a single line of code inside the function. This line does the
following: it creates a variable of the Number datatype, which makes sense,
since we're dealing with depths, and depths are described as numbers. This
variable is being set to the value returned by
MovieClip.getNextHighestDepth() as invoked on a MovieClip instance (I
presume) with the instance name mc102. And then ... well, and then nothing.
;) Nothing is being done with this number. A variable is set to the number
returned, but to get it to *do* anything, you'll have to use something like
MovieClip.swapDepths() on the movie clip in question.
So if btn102 is supposed to make mc102 "rise to the top," you'll want to
do something like this:
btn102.onRollOver = function():Void {
mc102.swapDepths(_root.getNextHighestDepth());
}
Loop up MovieClip.swapDepths to see exactly what it does. You can
either use it to trade places with another movie clip or send a clip to a
given depth number.
Don't just copy and paste what I've typed, though: you have to
understand what I've suggested. The visual stacking of the movie clips in
question depend entirely on their organiziation. If these movie clips are
nested *inside* their namesake buttons, swapthDepths() will only move them
up inside the buttons that house them -- it won't move them higher than each
other (does that make sense?).
If the movie clips are all on the main timeline, then you'll want to use
the _root (as a suggestion) to be your basis for the number
getNextHighestDepth() returns.
You have to give that method a point of view. The way you've written
your code, it looks as if each movie clip lies inside a button. The reason
I say this is because you haven't provided paths to any of the clips. From
btn102's point of view -- which is how its onRollOver function sees
things -- mc102 must be nested immediately inside it. If it was in the same
timeline as the button, it would be "one step up" from *inside* the button,
which means you might put _parent.mc102 as your path to mc102.
Give it a shot and come back if you need additional help. :)
David
stiller (at) quip (dot) net
"Luck is the residue of good design."