# Preloader bar

**URL:** https://forum.kirupa.com/t/preloader-bar/228021
**Category:** Uncategorized
**Created:** [June 4, 2007, 6:04pm UTC](https://forum.kirupa.com/t/preloader-bar/228021 "2007-06-04T18:04:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![blcarol](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@blcarol](https://forum.kirupa.com/u/blcarol)
#### Post date: [June 4, 2007, 6:04pm UTC](https://forum.kirupa.com/t/preloader-bar/228021/1 "2007-06-04T18:04:56Z")

</div>

hey  
im making a site and i have everything done, except i cant get the preloader bar to work!  
heres my script, that i ve copied from a tutorial online.

// variable to hold the value of total frames in this movie  
var loadAmount = \_totalframes;  
// loops until the frames loaded \>= to frames in this movie  
if (\_framesloaded \>= loadAmount) {  
// when framesloaded then move play head to frame called ‘start’  
gotoAndStop(2);  
} else {  
// otherwise do these calcualtions and display them on the scene  
// to show how much of the movie has been loaded.  
// variable to store the amount of bytes loaded so far  
loaded = Math.round(getBytesLoaded());  
// variable to store the total bytes of this movie  
total = Math.round(getBytesTotal());  
// calculate how much has been loaded and work that out as a percentage  
percent = Math.round((loaded/total) \* 100);  
// labels to display on the preloader scene  
bytesLoadedOutput = loaded;  
bytesTotalOutput = total;  
percentOutput = percent + “%”;  
// draw the progress bar  
pb.pbBar.\_width = pb.pbHolder.\_width \* (percent / 100);  
// loop the preloader scene.  
gotoAndPlay(1);  
}
