# AS3 Multiple Collision Problem

**URL:** <https://forum.kirupa.com/t/as3-multiple-collision-problem/328091>\
**Category:** flash\
**Created:** [April 18, 2012, 6:00pm UTC](https://forum.kirupa.com/t/as3-multiple-collision-problem/328091 "2012-04-18T18:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/n/50afbb/32.png) [@Nick\_Gonzalez](https://forum.kirupa.com/u/Nick_Gonzalez)\
**Post date:** [April 18, 2012, 6:00pm UTC](https://forum.kirupa.com/t/as3-multiple-collision-problem/328091/1 "2012-04-18T18:00:00Z")

</div>

I’m having trouble successfully colliding the player and the blocks that i have descending from the top of the screen. The movieclip (\_block) has multiple frames within it that are selected randomly every time it respawns at the top(\_block\_L, \_block\_C, \_block\_R). A simple set of IF statements are not accessing each other, so i figured that I need an Array with a FOR LOOP to handle this. So far I’m having no luck.

```auto

private function player():void       
{[INDENT]var collision:Boolean = false;
var blockPos:Array = [_block_L,_block_C,_block_R];
var blockLen:int = blockPos.length;

for (var i:int = 0; i<blockLen; i++)[/INDENT]
        {[INDENT] if (blockLen*.hitTestObject(_player))[/INDENT]
                {
                    collision = true;
                    if (collision)
                    {
                        
                        livesCount -= 1;
                        removeChild(getChildByName("_player"));
                    }
                }
         }
}

```
