# Multiple collision detection problem

**URL:** https://forum.kirupa.com/t/multiple-collision-detection-problem/294975
**Category:** Uncategorized
**Created:** [August 23, 2009, 6:45pm UTC](https://forum.kirupa.com/t/multiple-collision-detection-problem/294975 "2009-08-23T18:45:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Lucial](https://avatars.discourse-cdn.com/v4/letter/l/71c47a/32.png) [@Lucial](https://forum.kirupa.com/u/Lucial)
#### Post date: [August 23, 2009, 6:45pm UTC](https://forum.kirupa.com/t/multiple-collision-detection-problem/294975/1 "2009-08-23T18:45:26Z")

</div>

Hi all, I am trying to create a movie where several movieclips move towards the centre of the screen and organise themselves. I have the following code attached to the timeline, the clips move ok but dont interact. What am I doing wrong!?

```auto
target_mc = ["mc0", "mc1", "mc2", "mc3"];
 

 movement = function () {   
     numMcs = target_mc.length;
     for (i=0; i<numMcs; i++) {  
         McA = target_mc*;
 

         for (j=i+1; j<numMcs; j++) {
             McB = target_mc[j];
             temp_A = eval(McA);
             temp_B = eval(McB);  
             var xpos:Number = temp_A._x;
             var ypos:Number = temp_A._y;
             if (xpos>200) {
                 temp_A._x = xpos - 10;
                 if (temp_A, hitTest(temp_B)) {  
                     temp_A._x = xpos;
                 }
             };
             if (xpos<200) {
                 temp_A._x = xpos + 10;
                 if (temp_A, hitTest(temp_B)) {  
                     temp_A._x = xpos;
                  }
             };
             if (ypos<200) {
                 temp_A._y = ypos + 10;
                 if (temp_A, hitTest(temp_B)) {  
                     temp_A._y = ypos;
                  }
             };
             if (ypos>200) {
                 temp_A._y = ypos - 10;
                 if (temp_A, hitTest(temp_B)) {  
                     temp_A._y = ypos;
                 }
             }
         }
     }
 };
   
 this.onEnterFrame = function() {
 

 movement();
 

 }; 

```
