# Loading Bar of Preloader Fits to Stage Width

**URL:** https://forum.kirupa.com/t/loading-bar-of-preloader-fits-to-stage-width/279867
**Category:** flash
**Created:** [January 20, 2009, 4:15am UTC](https://forum.kirupa.com/t/loading-bar-of-preloader-fits-to-stage-width/279867 "2009-01-20T04:15:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![butbeautiful](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@butbeautiful](https://forum.kirupa.com/u/butbeautiful)
#### Post date: [January 20, 2009, 4:15am UTC](https://forum.kirupa.com/t/loading-bar-of-preloader-fits-to-stage-width/279867/1 "2009-01-20T04:15:56Z")

</div>

Hi everyone. I am currently using the preloader script below and I would like to make my loading bar auto stretch to stage width. Can anyone kindly give me the directions what I ought to change or addon? Thanks!

> // PRELOADER SCRIPT  
> myBar.\_xscale = 0;  
> loaded = false;  
> timer = 0;

onEnterFrame = function ()  
{  
loading = Math.round(\_root.getBytesLoaded().toString() / 1024);  
total = Math.round(\_root.getBytesTotal().toString() / 1024);  
percentage = Math.round(loading / total \* 100);  
myBar.\_xscale = myBar.\_xscale + (percentage - myBar.\_xscale) / 5;  
percentageTxt.\_x = myBar.\_width - percentageTxt.\_width / 2;  
percentageTxt.percentage = Math.round(myBar.\_xscale);  
if (myBar.\_xscale \> 99 && percentage == 100 && loaded == false)  
{  
myBar.\_xscale = 100;  
timer = timer + 1;

```
            loaded = true;
            _root.play();
        }

    }

```
