Navigation actions. help

okay, I have six invisible buttons over a movie clip on my main timeline. Each on of those buttons calls multiple movie clips to play on a rollover. The problem I’m having is figuring out how to stop a rollerover action that happens on button 1 when the user rolls over button 2 or any other button. I’m wondering if there is a way to do this with variables.

Can anyone help?


in frame one, _root:

// build an array of all the rollover movies
movies = ["firstmovie","anothermovie" ... "lastmovie"];

then in each button:

_ _ _ _ for(j=0;j<_root.movies.length;j++){
_ _ _ _ _ _ _ _ _root[_root.movies[j]].gotoAndStop(1);
_ _ _ _ }
_ _ _ _ ... the rest of the button actions ...

that will make every movie in the movies array gotoAndStop(1), then you can make the one you want do something.

is that enough, or would you like more clarification?

That sounds good. I’ll try and mess around with it a little. I don’t understand the “j” stuff. could explain a little more?

thanks so much

it’s a for loop, especially useful for cycling through an array.

the first part (j=0) is the initial declaration, the second (j<_root.movies.length) is the test which it will run to see whether to continue running the loop or not, and the third (j++) is what it should do at the end of each loop, in this case increment j by 1.

so it runs the loop with j equaling 0 and will evaluate the first (0 index) element in _root.movies, and tell it to gotoAndStop(1). then it will increment j, test it, see that’s it’s still less than the length of _root.movies so run the code again. with j equaling 1. etc etc, until j = _root.movies.length, then the test has failed and it will move on to the next line in the code - after the for loop.


that’s great!! thanks. I’ll post another question if I have anything further.