# HitTesting against multiple movieclips within an Array.. GRR

**URL:** <https://forum.kirupa.com/t/hittesting-against-multiple-movieclips-within-an-array-grr/327084>\
**Category:** Uncategorized\
**Created:** [February 4, 2012, 7:28pm UTC](https://forum.kirupa.com/t/hittesting-against-multiple-movieclips-within-an-array-grr/327084 "2012-02-04T19:28:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisW182](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@ChrisW182](https://forum.kirupa.com/u/ChrisW182)\
**Post date:** [February 4, 2012, 7:28pm UTC](https://forum.kirupa.com/t/hittesting-against-multiple-movieclips-within-an-array-grr/327084/1 "2012-02-04T19:28:01Z")

</div>

Evening all, im having a really frustrating problem. I have 6 movieclips on the stage, all acting as ‘map areas’, these are named area1\_mc, area2\_mc and so on… I then have a car which i drive around the screen, this instance name is car\_mc …

All i want to do is do a HitTest to determine if the car is on one of the 6 areas…

i have the following

```auto
       

 function checkCarsPos(){
            
            var mapAreas:Array = [area1_mc, area2_mc, area3_mc, area4_mc, area5_mc, area6_mc];
            
            for (var i:int=0; i < mapAreas.length; i++)
            {
                if (mapAreas*.hitTestObject(car_mc)){
                    // Do nothing
                    trace ("on map");
                } else {
                    // Loose a life etc.
                    trace ("off map");
                }
            }
            
        }

```

The reason it is not working i think is it is expecting the car to be on ALL map areas in order for it to be “on map”. For example if the car is in the middle of area1\_mc, i get three traces. On map (refferign to it being on area1\_mc) then two traces of ‘off map’, because it obviously isnt on area2\_mc or area3\_mc.

Please help.
