# Advanced hitTest with buttons

**URL:** <https://forum.kirupa.com/t/advanced-hittest-with-buttons/105001>\
**Category:** Uncategorized\
**Created:** [March 22, 2004, 3:31am UTC](https://forum.kirupa.com/t/advanced-hittest-with-buttons/105001 "2004-03-22T03:31:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mlkedave](https://avatars.discourse-cdn.com/v4/letter/m/958977/32.png) [@mlkedave](https://forum.kirupa.com/u/mlkedave)\
**Post date:** [March 22, 2004, 3:31am UTC](https://forum.kirupa.com/t/advanced-hittest-with-buttons/105001/1 "2004-03-22T03:31:39Z")

</div>

I am using the following code for 5 different buttons:  
[AS]  
onClipEvent (enterFrame) {  
if (this.hitTest(\_root.\_xmouse, \_root.\_ymouse, true)) {  
this.nextFrame();  
} else {  
this.prevFrame();  
}  
}  
[/AS]

Is there a way to make it so when one button is clicked ) with the above AS attached, i can make it stay on the last frame or at least gotoAndStop on a frame? Then when a different button is pressed it is reset and the button pressed stops on its last frame. Any idea how this can be done? I have seen it on several sites.
