Smoothing out my preloader animation

a simple preloader, yet i’m having difficulties getting it to smoothly animate. It’s a simple equation, but i failed college algebra 3 times in a row, so clearly i’m not good with equations lol Here’s the code.


   stop();
onEnterFrame = function():Void {
    loadedBytes = _root.getBytesLoaded();
    totalBytes = _root.getBytesTotal();
    percent = Math.ceil((loadedBytes/totalBytes)*100);
    per = int(percent);
    loadbar._width = per+140;

if (loadedBytes >= totalBytes) {
    _root.gotoAndPlay(2);
    delete this.onEnterFrame;
} 
}

now the problem im having is the loadbar width ends up being 240(per+140) but i want it to go from 0-240
0 = 0%
240 = 100%