Buttons controlling movieclips, and swapDepths

I have what I thought would be a super simple animation that I just can’t make work.

I have 3 movieclips, each with very brief animation (sliding into view). Layered on top of these are 3 buttons. Each button corresponds to a movie clip. When you rollover the button, the button fades, and when you roll out, it returns gradually to its original state. When you click on each button, it should play its corresponding movie clip, keeping the movieclips below the buttons.

Here’s where I’m running into trouble. If I’m watching movie A and want to watch movie B, movie B must slide over movie A visually. Similarly, if I’m watching C and want to watch B or A, then A or B need to slide visually over C. Without knowing magically what order the user will click the buttons, I figured I must need to somehow use swapDepths, but the results of my tests have been buggy and jumpy, at best.

For the button rollover effect, I’m using the following code. I’m including it because I tend to think maybe it’s causing problems with the swapDepths code.

Any help would be hugely appreciated.


myButton_mc.onRollOver = function() {
this.onEnterFrame = function() {
this._currentframe == this._totalframes ? delete this.onEnterFrame : this.nextFrame();
};
};
myButton_mc.onRollOut = myButton_mc.onDragOut = function () {
this.onEnterFrame = function() {
this._currentframe == 1 ? delete this.onEnterFrame : this.prevFrame();
};
};