# HitTest problems

**URL:** <https://forum.kirupa.com/t/hittest-problems/287290>\
**Category:** Uncategorized\
**Created:** [April 29, 2009, 8:30am UTC](https://forum.kirupa.com/t/hittest-problems/287290 "2009-04-29T08:30:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SonOfChaos](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@SonOfChaos](https://forum.kirupa.com/u/SonOfChaos)\
**Post date:** [April 29, 2009, 8:30am UTC](https://forum.kirupa.com/t/hittest-problems/287290/1 "2009-04-29T08:30:14Z")

</div>

Okay, used previous advice to get the code working error free, but their is still no hit detection. I’m trying to avoid the hitTestpoint method and get this approach working.

package{  
import flash.display._;  
import flash.events._;

```
public class BoxAttack extends MovieClip{
    public var fireArray = new Array();
    public var nb:Box = new Box(Math.random()*500, Math.random()*400, Math.random()*3, Math.random()*3, Math.random()*.001, Math.random()*.001);
    
    public function BoxAttack(){
        
        //fires gun!
        stage.addEventListener(MouseEvent.MOUSE_DOWN, fired);
                    
        //creates a couple random sized/placed/scaling boxes!!
        for(var i:int; i&lt;3; i++){
        addChild(nb);
        }
         for(var t:int; t=fireArray.length; t++){
            if(fireArray[t].hitTestObject(nb)){
                 trace('hit');
            }
        }
    }
    
    //mouse fires!
    public function fired(eveter:MouseEvent){
        trace('working!');
        fireArray.push(addChild(new fireArm));
        trace(fireArray);
    }
}

```

}
