Bug with numbers and moving a simple MC over time?

This has been destroying my noggin for hours now. I have an MC within an MC that I want to move from left to right, starting at 6.5x and needing to end at its width +6.5c (so 494.5x every time). Depending on the TOTALSECONDS I put in, it changes every time. It is always off, never perfect, and it is boggling my mind. Here is my code.



TOTALSECONDS = 90; // you can make this any number
var pMove = (progressBar.blackBar.width + 6.5) / (TOTALSECONDS) /8;
progBarMovement = Math.round(pMove*1000)/1000;
var total = (TOTALSECONDS * 8) * progBarMovement;
trace (seasonLength * 8 + " and " + progBarMovement + " total = " + total);

myTimer = new Timer(1000/8, TOTALSECONDS*8);
myTimer.addEventListener(TimerEvent.TIMER, nowTick);
myTimer.start();

//THE TOTAL should be the same every time regardless of what TOTALSECONDS is set to.




private function nowTick(e:TimerEvent) {
progressBar.blackBar.x += progBarMovement;
}

progresBar.blackBar.width is equal to 488. Add 6.5 to it, and we have 494.5. Regardless of how many TOTALSECONDS I use, this bar needs to move across the screen from left to right perfectly until it reaches 494.5, which should equal the “total” found in the code. It works for some numbers, doesn’t for others. It is like numbers are being lost in transit. If I set the TOTALSECONDS to 10, it works perfectly. If I set the TOTALSECONDS to 90, it ends up at 476x rather than 495x where it needs to be. The longer the time, the worse it gets.

This should work flawlessly each and every time. This could not get any simpler, yet it is not working. Simple simple math and yet it doesn’t want to work. I have to be missing something. Maybe the .x coords can’t move on certain decimal digits, so those are being lost? No idea.

Any help would be so great. Thank you! :angel: