# hitTest basic help

**URL:** <https://forum.kirupa.com/t/hittest-basic-help/244824>\
**Category:** programming\
**Created:** [November 22, 2007, 7:30am UTC](https://forum.kirupa.com/t/hittest-basic-help/244824 "2007-11-22T07:30:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dec27](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@dec27](https://forum.kirupa.com/u/dec27)\
**Post date:** [November 22, 2007, 7:30am UTC](https://forum.kirupa.com/t/hittest-basic-help/244824/1 "2007-11-22T07:30:32Z")

</div>

hi everybody,

I’m experimenting and learning… please be patient!

There are 25 objects moving randomly on stage.  
The hero moves up and down

What I want is to know is when the hero is being hit by the intruders, so far this is what I have:

[AS]onClipEvent (enterFrame) {  
for (i=0; i\<=25; i++) {  
var dots = \_root[“dot”+i];  
trace (dots)  
if (\_root.box\_mc, hitTest(dots)) {  
\_root.text = “Collision Detected”;  
} else {  
\_root.text = “No Collision”;  
}  
}  
}  
[/AS]

thanks in advanced.

:pac:
