# Built-in hitTest() vs this one

**URL:** <https://forum.kirupa.com/t/built-in-hittest-vs-this-one/292606>\
**Category:** Uncategorized\
**Created:** [July 16, 2009, 9:59am UTC](https://forum.kirupa.com/t/built-in-hittest-vs-this-one/292606 "2009-07-16T09:59:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wkt](https://avatars.discourse-cdn.com/v4/letter/w/ed655f/32.png) [@wkt](https://forum.kirupa.com/u/wkt)\
**Post date:** [July 16, 2009, 9:59am UTC](https://forum.kirupa.com/t/built-in-hittest-vs-this-one/292606/1 "2009-07-16T09:59:19Z")

</div>

Hi there

On my way to learn how to do the SAT way (separating axis theorem way), I created a function like this:

```auto

function cDetect (ob1:MovieClip,ob2:MovieClip) {
 var xOverlap:Boolean
 var yOverlap:Boolean
 var b1:Object = ob1.getBounds(_root)
 var b2:Object = ob2.getBounds(_root)
 if (b1.xMin > b2.xMax or b1.xMax < b2.xMin) {
  xOverlap = false
 } else {
  xOverlap = true
 }
 if (b1.yMin > b2.yMax or b1.yMax < b2.yMin) {
  yOverlap = false
 } else {
  yOverlap = true
 }
 if (xOverlap and yOverlap) {
  _root.cPhrase._visible = true//There is collision between the 2 objects
 } else {
  _root.cPhrase._visible = false//There is no collision between the 2 objects
 }
 _root.xoText.text = xOverlap
 _root.yoText.text = yOverlap
}

```

Will this thing be any better than the Flash built-in MovieClip.hitTest(x,y,shapeFlag)?

They do the same. My function cDetect() does bounding box hitTest.

Thanks in advance.
