I hate the way flash just seems to distroy math formulas!

ok You all know the formula y = mx+b, flash seems to hate it
To run this code you will need a black bacground and a MC with the AS export name of ng.
[AS]_global.Slopes = [];
function mapEngine() {
firstTurraneX = Math.random()*100;
firstTurraneY = 250;
moveTo(0, 250);
do {
slY = firstTurraneY;
slX = firstTurraneX;
firstTurraneX = firstTurraneX+250-Math.random()200;
ifNumber = Math.random()50;
if (ifNumber>25) {
firstTurraneY += Math.random()100;
} else {
firstTurraneY -= Math.random()100;
}
lineStyle(1, 0xFFFFFF);
lineTo(firstTurraneX, firstTurraneY);
slKey = (-firstTurraneY+slY)/(-firstTurraneX+slX);
combo = {slope:slKey, xBig:firstTurraneX, xSmall:slX, bSetter:slY};
Slopes.push(combo);
} while (firstTurraneX<500);
}
var test = mapEngine();
Slopes.reverse;
na = attachMovie(“ng”, “k”, 100);
na._y = 250;
_global.i = 0;
_global.B = 250
onEnterFrame = function () {
na._x++;
M = Slopes
.slope;
gX = Slopes
.xBig;
lX = Slopes
.xSmall;
na._y = M
na._x+B;
if ((na._x>gX)) {
i++
B = na._y
trace(B);
}
};[/AS]
as you can see it jump arround more than a mexican bean, so any help would Gravely help me
Thanks In Advace
Hi-Nu