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!?
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();
};