# Hit testing between classes

**URL:** <https://forum.kirupa.com/t/hit-testing-between-classes/329961>\
**Category:** flash\
**Created:** [November 12, 2012, 6:25pm UTC](https://forum.kirupa.com/t/hit-testing-between-classes/329961 "2012-11-12T18:25:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FJW](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@FJW](https://forum.kirupa.com/u/FJW)\
**Post date:** [November 12, 2012, 6:25pm UTC](https://forum.kirupa.com/t/hit-testing-between-classes/329961/1 "2012-11-12T18:25:07Z")

</div>

Hi once again my project is stuck on a hit test requirement. Basically I have a main class where the stage objects are created so theRoller = new Roller(stage);  
stage.addChild(theRoller); On the Stage is another movieclip ourMan = new Man(stage);  
stage.addChild(ourMan); The Man object is controlled by key presses from Man.as and that works just fine. The Roller class is Roller.as and The roller, rolls from left to right. have put ‘hit boxes’ on Man at left and right sides called right\_hit and left\_hit. How can I detect if the Roller object hits the Man hit box? I have in main class constructor ourMan.addEventListener(“target\_R\_hit”, ManHit, false, 0, true); and private function ManHit(e:Event)  
{  
trace(“ManHitR”);  
} //Have tried a few other things like 'if (theRoller.hitTestObject(target\_R\_hit))  
{  
trace(“Hit R”);  
}can’t get anything to register. Can anyone help me to understand this? Best regards FJW
