# hitTest question

**URL:** <https://forum.kirupa.com/t/hittest-question/82403>\
**Category:** Uncategorized\
**Created:** [March 10, 2005, 2:51am UTC](https://forum.kirupa.com/t/hittest-question/82403 "2005-03-10T02:51:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lacus](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@Lacus](https://forum.kirupa.com/u/Lacus)\
**Post date:** [March 10, 2005, 2:51am UTC](https://forum.kirupa.com/t/hittest-question/82403/1 "2005-03-10T02:51:24Z")

</div>

This question might be simple to you guys but it’s a pain to me \>.\<  
Please help me take a look on it… Thank you

```auto
 
if (hand2._visible === true){

  if (hand2.hitTest(empty0)){correctscore += 1; empty0._x += 1000;}
  if (hand2.hitTest(empty1)){correctscore += 1; empty1._x += 1000;}
  if (hand2.hitTest(empty2)){correctscore += 1; empty2._x += 1000;}
  if (hand2.hitTest(empty3)){correctscore += 1; empty3._x += 1000;}
}

```

These codes are workable…  
However if I want to change it to a for loop like this:

```auto

if (hand2._visible === true){
  for (var k = 0; k < 4; k++){
  if (hand2.hitTest(this["empty" + k])){correctscore += 1; this["empty" + k]._x += 1000;}
 }
}

```

The codes won’t work… \>.\<  
Thanks for reading this question…
