Multistate Button?

Hello,

I’m trying to make a button that has an animation as well as a function. Currently i have an MC with an animation in it and on roll over/out it plays forward or in reverse. Now I’ve tried adding a function that when clicked, the animation goes straight to the end of the animation until clicked again.


onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		_root.diagram.bottom_2_MC.nextFrame();
	} else {
		_root.diagram.bottom_2_MC.prevFrame();
	}
}

Tried with variables, setting whether or not it was clicked, yes or no. But the enterFrame kept resetting it.

Anyone have any suggestion on how to achieve this?