Animated buttons that stay down/visited

hi, I’m new to flash like a lot of people that come and ask questions probably are but I’ve got a problem with my animated buttons. I’ve made them movie clips as I read that I should do. each one has it’s up frame as #1, the Over animation is from frame 2 - frame 18 and the down is frame 19. They are named button1 - button6.

I tried to use this script made by claudio by placing it in the same layer as the buttons. here’s the script

/*
your button is in fact a movie clip with 3 frames
frame 1 is normal state
frame 2 is over state
frame 3 is visited state
name your buttons button1, button2, button3 and so on…
*/
total = 3;//number of buttons - I changed it to 6
this.onEnterFrame = function() {
for (var i = 1; i<=total; i++) {
if (this[“button”+i]._currentframe != 3) { //do I change this? (I’ve tried)
if (this[“button”+i].hitTest(_xmouse, _ymouse, false)) {
this[“button”+i].gotoAndStop(2); //I changed this to 18
} else {
this[“button”+i].gotoAndStop(1);
}
}
}
};
for (var i = 1; i<=total; i++) {
this[“button”+i].onPress = function() {
this.gotoAndStop(3); //I changed this to 19
};
}

The result was that all of the buttons just keep playing from the start of the page. my flash scripting is very sketchy so this all only makes half sense to me.
Are the changes I made right? do I need to add anything else? and did I put the script in the right place (the same layer as the buttons)

any help is much appreciated. thanks,
Mike

I would recommend not actually placing animation in a button (and changing the position of the up/over/down frames) but placing the animation in a movieclip on the frame. The you won’t have to make any changes to claudio’s code.

heh simple enough explination thanks