# How to check if no items in an array are being hitTestObjected?

**URL:** https://forum.kirupa.com/t/how-to-check-if-no-items-in-an-array-are-being-hittestobjected/635363
**Category:** flash
**Created:** [October 6, 2016, 2:31am UTC](https://forum.kirupa.com/t/how-to-check-if-no-items-in-an-array-are-being-hittestobjected/635363 "2016-10-06T02:31:07Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Twisted4000](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@Twisted4000](https://forum.kirupa.com/u/Twisted4000)
#### Post date: [October 6, 2016, 2:31am UTC](https://forum.kirupa.com/t/how-to-check-if-no-items-in-an-array-are-being-hittestobjected/635363/1 "2016-10-06T02:31:08Z")

</div>

So there’s an array of notch markers that appear on a bar. You have your own little bar that slides across and, when it touches any the notches, you press a key to get a point. The problem is, I want to make it so that when you’re NOT touching any of the notches and you press that same key, you LOSE a point instead.

for (var i:Number = 0; i \< hit\_marker\_array.length; i++)  
{  
if (hitter.hitTestObject(hit\_marker\_array[i]))  
{  
hitter\_hitting = “true”;  
}  
else  
{  
hitter\_hitting = “false”;  
}  
}

Obviously this doesn’t work because, when ONE of the items in the array is not being touched, the var “hitter\_hitting” (temporary name for it, sorry, lol) becomes “false”. All I want to do is make something that checks for whether the hitter is touching ANY of the markers or NONE of them. Any ideas? Thank you.

---

<div class="post-metadata">

### Author: ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)
#### Post date: [October 6, 2016, 7:49am UTC](https://forum.kirupa.com/t/how-to-check-if-no-items-in-an-array-are-being-hittestobjected/635363/2 "2016-10-06T07:49:41Z")

</div>

`for (var i:Number = 0; i < hit_marker_array.length; i++)
    if (hitter.hitTestObject(hit_marker_array[i]))
        hitter_hitting = "true"
if(hitter_hitting != "true") doSomething()`

Something like that maybe?
