# Yet Another Collision Detection Question

**URL:** <https://forum.kirupa.com/t/yet-another-collision-detection-question/231604>\
**Category:** flash\
**Created:** [July 6, 2007, 4:07am UTC](https://forum.kirupa.com/t/yet-another-collision-detection-question/231604 "2007-07-06T04:07:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bpdp](https://avatars.discourse-cdn.com/v4/letter/b/c0e974/32.png) [@bpdp](https://forum.kirupa.com/u/bpdp)\
**Post date:** [July 6, 2007, 4:07am UTC](https://forum.kirupa.com/t/yet-another-collision-detection-question/231604/1 "2007-07-06T04:07:02Z")

</div>

I’m using this tutorial: [http://www.kirupa.com/developer/actionscript/advanced\_collision.htm](http://www.kirupa.com/developer/actionscript/advanced_collision.htm) but using bitmap images. I can’t use bitmapData because I have to target flash 7 and lower.

as you can see it’s still using the boundingbox of one image (the cursor) to test for collisions with the perimeter of the other. how can I modify the code to get this to work properly.

```auto
onClipEvent(enterFrame) {
//collision detection
hit = false; //set hit variable to false
for(i in _root.brain.perimeter) { //loop through all opjects in perimeter clip
point = new Object(); //create a new generic object to hold the coordinates
point.x = _root.brain.perimeter*._x; //x coordinate
point.y = _root.brain.perimeter*._y; //y coordinate
_root.brain.localToGlobal(point); //convert coordinates from local (within shape1) to global (_root)

if(this.hitTest(point.x, point.y, true)) { //check for collision between perimeter clip coordinates and shape 2
hit = true; //make our hit variable true
}
}
if(hit) { //check out hit variable for a true or false collision detection
this._alpha = 50; //do actions if they touching
} else {
this._alpha = 100; //do actions if they aren't touching
}
}

```

thank you for any input.
