# AS2:: Multiple hitTests

**URL:** https://forum.kirupa.com/t/as2-multiple-hittests/288584
**Category:** flash
**Created:** [May 18, 2009, 2:44pm UTC](https://forum.kirupa.com/t/as2-multiple-hittests/288584 "2009-05-18T14:44:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lilleypants](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lilleypants](https://forum.kirupa.com/u/lilleypants)
#### Post date: [May 18, 2009, 2:44pm UTC](https://forum.kirupa.com/t/as2-multiple-hittests/288584/1 "2009-05-18T14:44:59Z")

</div>

I am making a game where one object needs to hit test many so I have been trying to build it like so:

```auto
function HitTester() {
	trace("calling function");
	for (i=0; i<12; i++) {
		
		_global.CometArray.push(_root["comet"+i+"_mc"]);
		temp_A = eval(_global.CometArray);
		if (bottomHit_mc.hitTest(temp_A)) {
		trace("WOOOO");
	}
	}

	
}

```

and to active it:

```auto

bottomHit_mc.onEnterFrame = function() {
 HitTester();
}

```

But this doesn’t seem to work and as the enterFrame calls in the function so many times it is really slowing everything down.

Can anyone tell me where I am going wrong or a better way of doing it?

Thanks!
