# Preloader/progress bar problems

**URL:** <https://forum.kirupa.com/t/preloader-progress-bar-problems/292070>\
**Category:** flash\
**Created:** [July 9, 2009, 4:04pm UTC](https://forum.kirupa.com/t/preloader-progress-bar-problems/292070 "2009-07-09T16:04:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gemixin](https://avatars.discourse-cdn.com/v4/letter/g/ebca7d/32.png) [@Gemixin](https://forum.kirupa.com/u/Gemixin)\
**Post date:** [July 9, 2009, 4:04pm UTC](https://forum.kirupa.com/t/preloader-progress-bar-problems/292070/1 "2009-07-09T16:04:16Z")

</div>

I’ve got an SWF that’ll be viewed via a webpage, that loads a choice of 7 different web pages/SWFs depending on buttons clicked.

The problem is these files are quite big and take a good few seconds to load each, so for each SWF, I created a progress bar on frame 1, that then loads frame 2 (where all the code and content is) once it’s ready. The code I used is as follows:

stop();

var myPercent:Number;  
import fl.controls.ProgressBarMode;

myBar.mode=ProgressBarMode.MANUAL;

stage.addEventListener(Event.ENTER\_FRAME, loadProgress);

function loadProgress(e:Event) :void  
{  
var bytesLoaded = stage.loaderInfo.bytesLoaded;  
var bytesTotal = stage.loaderInfo.bytesTotal;  
myBar.setProgress(bytesLoaded, bytesTotal);

```
myPercent = bytesLoaded/bytesTotal;
statusTxt.text = String(Math.round(myPercent*100))+"%";

if (bytesLoaded==bytesTotal) 
{
    stage.removeEventListener(Event.ENTER_FRAME, loadProgress);
    gotoAndStop(2);
}

```

}

The problem is as you can see from [http://www.gemixin.co.uk/UELVirtualLab.html](http://www.gemixin.co.uk/UELVirtualLab.html) is that it takes ages to load the loader! So I end up with a blank screen then the loading bar, then the content. Making the loading screen pretty useless!

Any ideas on how to make it so frame 1 shows up straight away?
