Why can't i get this. this should be easy for everyone else

I’m having trouble with this little dot racing thing. This is my first post on anything ever. I am trying to make 3 dots go at random speeds across a screen. then when one gets to the end, i want them all to stop. and maybe a text thing says what won. for each dot there is the code:

onClipEvent (enterFrame) {
speed = random(5)+1;
this._x += speed;
if (this._x>=510) {
this.speed = 0;
_root.red.speed = 0;
_root.blue.speed = 0;
}
}

But none of the dots stop. I don’t know what i did wrong. I’m not very strong with actionscript. could someone help?

Try this instead. For Each Movieclip.

onClipEvent (enterFrame) {
_root.speed = random(5)+1;
this._x += _root.speed;
if (this._x>=510) {
this._x = 510;
}
}

Might wanna play wround with the +1, a bit.
That way u can see which makes it to the end first.

Thanx. your my first replay for my first post. i’ll have to try that now.