# Test hit area for polygon?

**URL:** <https://forum.kirupa.com/t/test-hit-area-for-polygon/186940>\
**Category:** flash\
**Created:** [April 25, 2006, 2:27pm UTC](https://forum.kirupa.com/t/test-hit-area-for-polygon/186940 "2006-04-25T14:27:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashpipe](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@flashpipe](https://forum.kirupa.com/u/flashpipe)\
**Post date:** [April 25, 2006, 2:27pm UTC](https://forum.kirupa.com/t/test-hit-area-for-polygon/186940/1 "2006-04-25T14:27:34Z")

</div>

I’ve got a movie that lets the user create several polygons by clicking points.

Is there a way to find out if the user rolls over the actual polygon??

I tried using:

```auto
myVars = threat_mc0.hitTest(this._xmouse, this._ymouse);

```

but that returns “true” if the user rolls over the bounding rectangle area of the polygon, and I only want to test if they’re within the actual fill of the polygon…

Thanks!!

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 25, 2006, 2:38pm UTC](https://forum.kirupa.com/t/test-hit-area-for-polygon/186940/2 "2006-04-25T14:38:41Z")

</div>

Take a look at this, this is to test collision of odd shaped objects:)

[http://www.kirupa.com/developer/actionscript/advanced\_collision.htm](http://www.kirupa.com/developer/actionscript/advanced_collision.htm)

---

<div class="post-metadata">

**Author:** ![flashpipe](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@flashpipe](https://forum.kirupa.com/u/flashpipe)\
**Post date:** [April 25, 2006, 4:18pm UTC](https://forum.kirupa.com/t/test-hit-area-for-polygon/186940/3 "2006-04-25T16:18:18Z")

</div>

Cool tutorial, but I’m doing something a little different, so this doesn’t really help much.

First, the user is drawing the points of the poly (which makes drawing the little boundary rects problematic) and AS is doing a fill. Then, the user has to click on an area within the bounds of that poly, so testing to see if the rects hit won’t work.

Any ideas?? I attached my test .fla (just trying out different hit/rollover tests) in case it’s any help.

Thanks!!

---

<div class="post-metadata">

**Author:** ![flashpipe](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@flashpipe](https://forum.kirupa.com/u/flashpipe)\
**Post date:** [April 25, 2006, 5:29pm UTC](https://forum.kirupa.com/t/test-hit-area-for-polygon/186940/4 "2006-04-25T17:29:05Z")

</div>

I think I got it…I attached the new fla, but, basically, I just used the script

```auto
if(shape_mc.hitTest(this._xmouse, this._ymouse, true)){
 myVars = true;
}else{
 myVars = false;
}

```

and it works!

Thanks!!
