[FMX2004][AS1] Function/Looping

Hi,

i’m making a menu (some kind of slideshow) that plays diferents movieclips.
the switch between movieclips is made through buttons and the Left/Right Key.
Because of the transition between the current displayed movieClip and the next movieClip, i need to play both movieclips at the same time.

So far, i’ve made the menu this way:

Forward

myButton1.onPress = function() {
if (_root.MovieClip1._currentframe == 10) {
_root.MovieClip1.play();
_root.MovieClip2.play();
} else if (_root.MovieClip2._currentframe == 10) {
_root.MovieClip2.play();
_root.MovieClip3.play();
[size=1] ////(and so on…)[/size]
}
};

Backward

myButton2.onPress = function() {
if (_root.MovieClip2._currentframe == 10) {
_root.MovieClip2.play();
_root.MovieClip1.play();
} else if (_root.MovieClip3._currentframe == 10) {
_root.MovieClip3.play();
_root.MovieClip2.play();
[size=1] ////(and so on…)[/size]
}
};

…well, i need to make that for 20 movieclips… or maybe more, or maybe less… :bored:
and then, i’ve to repeat that for each button, and for each key… and the thing gets a kind of messy… :smirk:

So, what do i need is a global function, simpler, without have to make all the conditions for each movieclip.
I know that it’s possible to make it with looping, but can figure out how. :puzzled:

I would apreciate some help with the function… :}