# Hittest will not work in Array

**URL:** <https://forum.kirupa.com/t/hittest-will-not-work-in-array/282213>\
**Category:** flash\
**Created:** [February 19, 2009, 2:40am UTC](https://forum.kirupa.com/t/hittest-will-not-work-in-array/282213 "2009-02-19T02:40:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swhites](https://avatars.discourse-cdn.com/v4/letter/s/c67d28/32.png) [@swhites](https://forum.kirupa.com/u/swhites)\
**Post date:** [February 19, 2009, 2:40am UTC](https://forum.kirupa.com/t/hittest-will-not-work-in-array/282213/1 "2009-02-19T02:40:14Z")

</div>

I am trying to use the following code to simplify multiple Hittests using an Array, but the code won’t work. Can anyone tell me why?

var blockArray:Array = new Array(“block1”, “block2”, “block3”);

player.addEventListener(Event.ENTER\_FRAME, blockTest);

function blockTest(evt:Event):void {  
for(var i=0; i\<blockArray.length; i++) {  
if(player.hitTestObject(blockArray\*)) {  
player.x +=40;  
}  
}  
}

Thank you in advance.
