# Need some help on hitTest

**URL:** https://forum.kirupa.com/t/need-some-help-on-hittest/204978
**Category:** Uncategorized
**Created:** [October 25, 2006, 3:04am UTC](https://forum.kirupa.com/t/need-some-help-on-hittest/204978 "2006-10-25T03:04:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![cnboy0212](https://avatars.discourse-cdn.com/v4/letter/c/bc79bd/32.png) [@cnboy0212](https://forum.kirupa.com/u/cnboy0212)
#### Post date: [October 25, 2006, 3:04am UTC](https://forum.kirupa.com/t/need-some-help-on-hittest/204978/1 "2006-10-25T03:04:21Z")

</div>

Just like the picture below,i only want the codes execute if the object touches the side of the rectangle,but not the corner,how do i do that?

[![](http://img120.imageshack.us/img120/4883/rectanglewg6.th.gif)](http://img120.imageshack.us/my.php?image=rectanglewg6.gif)

---

<div class="post-metadata">

### Author: ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)
#### Post date: [October 25, 2006, 6:55am UTC](https://forum.kirupa.com/t/need-some-help-on-hittest/204978/2 "2006-10-25T06:55:51Z")

</div>

[QUOTE=cnboy0212;1984892]Just like the picture below,i only want the codes execute if the object touches the side of the rectangle,but not the corner,how do i do that?

[![](http://img120.imageshack.us/img120/4883/rectanglewg6.th.gif)](http://img120.imageshack.us/my.php?image=rectanglewg6.gif)[/QUOTE]

I think the easiest way would be to have arounded corner mc with \_alpha = 0 on top of it and hitTest that.  
Or something like this

```auto
//will have to adjust the value "15" to suit
//mc instance name mc
mindist = Math.sqrt(mc._width/2*mc._width/2+mc._height/2*mc._height/2)-15;
onEnterFrame = function () {
	dist = Math.sqrt((_xmouse-mc._x)*(_xmouse-mc._x)+(_ymouse-mc._y)*(_ymouse-mc._y));
	if (mc.hitTest(_xmouse, _ymouse) && dist<mindist) {
		trace("hit");
	}
};

```
