Navigation AS preference

Hey, I’m new to posting but have been an avid user of this site for a while now… tried searching to find something that would help my cause but didn’t find anything.

Basically, i’m wondering which is the best way to go about controling this mc for navigation fla is attached. For now i’ve got the one button functional using this AS at the root:

but1.onrollover = function() {
pic1.pic1.gotoAndStop(2);
};
but1.onrollout = function() {
pic1.pic1.gotoAndStop(1);
};
but1.onrelease = function() {
pic1.gotoAndStop(2);
};

This works fine, but there are going to be over 30 buttons (for loading swf’) so this could get pretty ugly. Is there are better way to go about doing this? If so, would it effect loading time as well?

Help is much appreciated!

well u could do a for loop if the target frames of each button are consecutive: like this (your buton names have to be bu1, but2, etc)

[AS]
for(var i = 1; i<=30; i++){
_root[“but”+i].onRollOver = function(){
//blaaaah
}
//bla blah
}
[/AS]

hope u get the picture

Thanks…! I’ve added that code, but now i will need to get it to make each individual button rollover. The way i have it set up now, it will always call the first button to rollover. I’ve attached the modified version so you can see where I’m at.

Thanks again :thumb:

I made the code like this:

for(var i = 1; i<=30; i++){
_root[“but”+i].onRollOver = function(){
pic1.pic1.gotoAndStop(2);
}
_root[“but”+i].onRollOut = function(){
pic1.pic1.gotoAndStop(1);
}
_root[“but”+i].onRelease = function(){
pic1.gotoAndStop(2);
}
}

Now i’m wondering if i should make the buttons inside the movie clip… I’ll try that untill someone comes and saves the day. Peace.

so you have it working now? glad i helped

Well, i actually have half of it working now. It will work for but1, but not for but2, 3, 4, 5, …

read the third post down

do you see what i mean?