# How to HitTest Instances of a Class?

**URL:** https://forum.kirupa.com/t/how-to-hittest-instances-of-a-class/248256
**Category:** flash
**Created:** [January 5, 2008, 10:33pm UTC](https://forum.kirupa.com/t/how-to-hittest-instances-of-a-class/248256 "2008-01-05T22:33:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Haig\_Larsen](https://avatars.discourse-cdn.com/v4/letter/h/c67d28/32.png) [@Haig\_Larsen](https://forum.kirupa.com/u/Haig_Larsen)
#### Post date: [January 5, 2008, 10:33pm UTC](https://forum.kirupa.com/t/how-to-hittest-instances-of-a-class/248256/1 "2008-01-05T22:33:10Z")

</div>

Alright, I’m finally trying to get my chops together with AS 3.0 and make everything its own class. I make mainly games, and I’m having a hard time figuring out how to hitTest 2 instances of separate classes.

In this case, I’ve got a Bomb class and a Dinosaur class that I instantiate using functions as follows (The user drops bombs which fall onto the Dinosaurs):

function dropBomb() {  
var bomb:Bomb = new Bomb();  
addChild(bomb);

}

function makeDinosaur(evt:TimerEvent) {  
var newDino:Dinosaur = new Dinosaur();  
addChild(newDino);

}

The classes handle their respective animations, but when I try to use HitTest on the main timeline, it doesn’t recognize “bomb” or “newDino” because they’re inside of functions. Does anyone know how to do this?

Thanks,  
Haig
