Help me out with my AS (i attached my code :) )

I have applied this code to all of my my bottons (by the way i have 5)…

[AS]
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
[/AS]

The thing is I want to make it so when I click a button (with the above code attached), the button stays at the last frame.

Also, can someone give me an example where an if then statment says something like, if MovieClip1 is on its frame1, MovieClip2 goes to its frame2. Thanks.