Richey
07-30-2008, 03:25 PM
Hey, I've been reading through the tutorials on loops and despite getting half way there I still can't manage to get round the final problem. I know how I'm going wrong and what needs to be happening but I can't seem to script it. Here is what I have so far:
var i = 0;
onMouseDown = function () {
var ball:MovieClip = attachMovie("ball", "ball"+_root.i, _root.i++);
ball._x = _xmouse;
ball._y = _ymouse;
};
onEnterFrame = function () {
for (i=0; i<100; i++) {
_root["ball"+i]._y -= 5;
}
};
Basically, I want my attached movie clips to move via actionscript after they've been attached. But after each click, instead on continuing moving they just stop and the movement code only affects the latest attached clip.
I would appriciate some help coding the loop to allow this. Thanks!
var i = 0;
onMouseDown = function () {
var ball:MovieClip = attachMovie("ball", "ball"+_root.i, _root.i++);
ball._x = _xmouse;
ball._y = _ymouse;
};
onEnterFrame = function () {
for (i=0; i<100; i++) {
_root["ball"+i]._y -= 5;
}
};
Basically, I want my attached movie clips to move via actionscript after they've been attached. But after each click, instead on continuing moving they just stop and the movement code only affects the latest attached clip.
I would appriciate some help coding the loop to allow this. Thanks!