I am trying create to move objects (boxes, named box_1, box_2 etc) to positions on the stage (xPos_1, xPos_2 etc) using onEnterFrames. I can make all the boxes move individually, but I cant get them to move together. I am using the following code in an attempt to move 3 boxes.
If anyone can point me in the right direction it would be appreciated!
while (k < 3) {
_root.onEnterFrame = function() {
_root["box_"+k]._x -= 5;
_root["box_"+k]._y -= 5;
if (_root["box_"+k]._x <= _root["xPos_"+k]) {
_root["box_"+k]._x = _root["xPos_"+k];
}
if (_root["box_"+k]._y <= yPos) {
_root["box_"+k]._y = yPos;
}
}
k++;
}