Moving dots change rate (timer)

I have a very lengthy class that “transmits” three red dots – dot1, dot2, and dot3 – from one box to another along a line that takes two 90 degree corners. I’ve attached a picture illustrating. Here are snippets of code illustrating how the dots move:

Transmit 1st dot, started by [FONT=Courier New]data2TimerCase4B[/FONT]:


[FONT=Courier New]if (dot1.y > yVertex1) {[/FONT]
[FONT=Courier New]    dot1.y -= dataStep * (_fromY - yVertex1);[/FONT]
[FONT=Courier New]         if (dot1.y < _fromY - dotGap) {[/FONT]
[FONT=Courier New]              data2TimerCase4B.start();[/FONT]
[FONT=Courier New]         }[/FONT]
[FONT=Courier New]} else if (dot1.x < xVertex2) {[/FONT]
[FONT=Courier New]    dot1.y = yVertex1;[/FONT]
[FONT=Courier New]    dot1.x += dataStep * (xVertex2 - xVertex1);[/FONT]
[FONT=Courier New]} else if (dot1.y > _toY && dot1.x > xVertex1) {[/FONT]
[FONT=Courier New]    dot1.x = xVertex2;[/FONT]
[FONT=Courier New]    dot1.y -= dataStep * (yVertex2 - _toY);[/FONT]
[FONT=Courier New]} else if (dot1.y <= _toY) {[/FONT]
[FONT=Courier New]    data1TimerCase4B.stop();[/FONT]
[FONT=Courier New]    removeChild(dot1);[/FONT]
[FONT=Courier New]}[/FONT]

Transmit 2nd dot, started by [FONT=Courier New]data2TimerCase4B[/FONT]:


[FONT=Courier New]if (dot2.y > yVertex1) {[/FONT]
[FONT=Courier New]    dot2.y -= dataStep * (_fromY - yVertex1);[/FONT]
[FONT=Courier New]         if (dot2.y < _fromY - dotGap) {[/FONT]
[FONT=Courier New]              data3TimerCase4B.start();[/FONT]
[FONT=Courier New]         }[/FONT]
[FONT=Courier New]} else if (dot2.x < xVertex2) {[/FONT]
[FONT=Courier New]    dot2.y = yVertex1;[/FONT]
[FONT=Courier New]    dot2.x += dataStep * (xVertex2 - xVertex1);[/FONT]
[FONT=Courier New]} else if (dot2.y > _toY && dot2.x > xVertex1) {[/FONT]
[FONT=Courier New]    dot2.x = xVertex2;[/FONT]
[FONT=Courier New]    dot2.y -= dataStep * (yVertex2 - _toY);[/FONT]
[FONT=Courier New]} else if (dot2.y <= _toY) {[/FONT]
[FONT=Courier New]    data2TimerCase4B.stop();[/FONT]
[FONT=Courier New]    removeChild(dot2);[/FONT]
[FONT=Courier New]    // trace("data2TimerCase4B stopped");[/FONT]
[FONT=Courier New]}[/FONT]

The third dot is started in the same fashion as the second.

The problem I’m seeing is this: On every “leg” of the dots’ movement – meaning between (_fromX, _fromY) and (xVertex1, yVertex1), between (xVertex1, yVertex1) and (xVertex2, yVertex2), and between (xVertex2, yVertex2) and (_toX, _toY) – the distance between the dots varies depending on the length of the leg. The longer the leg, the wider the distance.

Also, the longer the leg, the faster the dots move – such that it takes a dot the same amount of time to traverse a long leg as it does to traverse a short leg. (If, say, _fromY and _toY are only different by two pixels, that ends up looking rather ridiculous. The dots really grind to a slow crawl, and pile up on each other.)

You can see (hopefully) what I mean by the picture.

So my question is, how can I fix this? I have thought of using ENTER_FRAME events rather than timers, but I thought I would pose my question to this forum first – that’s a very lengthy change to make.

I briefly changed this:


[FONT=Courier New]dot2.x += dataStep * (xVertex2 - xVertex1);[/FONT]

…to this:


[FONT=Courier New]dot2.x = dot1.x - dotGap;[/FONT]

…but that didn’t seem to make any difference.

Thanks!