# hitTest problem

**URL:** https://forum.kirupa.com/t/hittest-problem/15184
**Category:** flash
**Created:** [March 11, 2003, 4:48pm UTC](https://forum.kirupa.com/t/hittest-problem/15184 "2003-03-11T16:48:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![LeGrand](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@LeGrand](https://forum.kirupa.com/u/LeGrand)
#### Post date: [March 11, 2003, 4:48pm UTC](https://forum.kirupa.com/t/hittest-problem/15184/1 "2003-03-11T16:48:21Z")

</div>

Hey there, I’ve got a movie clip that has a line of mc’s each one expands elastically when the mouse comes near it . Now what I"m trying to do is apply a hitTest to it, so it rolls out and back in when I roll over a button. When I put everything in a mc and on the stage and apply the following script the tween gets stuck on the way back in. Anybody know what might be going on wrong here?

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

here’s the fla

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 11, 2003, 4:57pm UTC](https://forum.kirupa.com/t/hittest-problem/15184/2 "2003-03-11T16:57:51Z")

</div>

Don’t use hitTest for that…

this.onRollOver = function()  
{code here}  
this.onRollOut = function()  
{code here}

😉 Also you might wanna use gotoAndPlay instead of prev os next frames. Might work out better for what you are trying to grasp.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [March 11, 2003, 5:43pm UTC](https://forum.kirupa.com/t/hittest-problem/15184/3 "2003-03-11T17:43:14Z")

</div>

I’m not sure I understand. I put this code on my mc .Or is this a seperate button that I’m appling it to. And which code am I putting under that code . Sorry for the trouble I’m not that good with scripting yet.
