# Smoothing out my preloader animation

**URL:** <https://forum.kirupa.com/t/smoothing-out-my-preloader-animation/247349>\
**Category:** Uncategorized\
**Created:** [December 21, 2007, 4:02pm UTC](https://forum.kirupa.com/t/smoothing-out-my-preloader-animation/247349 "2007-12-21T16:02:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jibble](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jibble/32/2265_2.png) [@jibble](https://forum.kirupa.com/u/jibble)\
**Post date:** [December 21, 2007, 4:02pm UTC](https://forum.kirupa.com/t/smoothing-out-my-preloader-animation/247349/1 "2007-12-21T16:02:27Z")

</div>

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.

```auto

   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%
