## Calculating speed of scroll...

Evening, I'm using this here code to produce some lines. Now, the problem I'm having is that at a certain point (820), I want the movie to start scrolling to the left. I can get this to work, however I can't get the proper speed. As you can see, I've used some code to try to determine the speed, but it isn't working out properly. It is close, but then ends up falling off.

I don't know how to rectify this. If anyone has some insight, please let me know.

PHP Code:
``` function lines (r, x, y, dx, dy) {     var s = r, m = this.createEmptyMovieClip (this.getNextHighestDepth (), this.getNextHighestDepth ());     m.moveTo (x, y), m.lineStyle (0), m.onEnterFrame = function ()     {         if (--r)         {             //trace ("x:" + x + " y:" + y);             this.lineTo (x += (dx - x) / r, y += (dy - y) / r);             m._x -= m_move;         }         else         {             (r = s, dx = dx + random (50), dy = random (Stage.height));             trace ("dx:" + dx + " tx:" + tx);             trace ("dx-tx/20 + ((dx - tx) / framerate)= " + m_move);             if (dx >= 820)             {                 m_move = ((x - tx) / framerate);                 // m_move = ((dx - tx) / framerate);             }             tx = x;             // tx = dx;             if (dy > bottom || dy < top)             {                 while (dy > bottom || dy < top)                 {                     dy = random (Stage.height);                 }             }         }     }; } //// var left = this.frame_mc._x + 1; var right = left + this.frame_mc._width; var top = this.frame_mc._y + 5; var bottom = top + this.frame_mc._height - 5; //// var w = 50; var h = random (Stage.height); var i = 0; var framerate = 10; var tx = 0; var m_move = 0; //// if (h > bottom || h < top) {     while (h > bottom || h < top)     {         h = random (Stage.height);     } } // lines (framerate, left, this.frame_mc._height / 2, w + i, h);  ```