# Preload SWF

**URL:** https://forum.kirupa.com/t/preload-swf/80716
**Category:** flash
**Created:** [February 24, 2005, 4:28am UTC](https://forum.kirupa.com/t/preload-swf/80716 "2005-02-24T04:28:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![alwaysdrifting](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@alwaysdrifting](https://forum.kirupa.com/u/alwaysdrifting)
#### Post date: [February 24, 2005, 4:28am UTC](https://forum.kirupa.com/t/preload-swf/80716/1 "2005-02-24T04:28:56Z")

</div>

I am preloading a SWF file. The main problem is that the preloader **doesn’t appear till about 80%** of the SWF is loaded. When the percentage appears, it increments as normal.

I have 40 frames with 23 layers, all layers appear at different frames, several levels, masks and the size is 27k. The \_root.getBytesTotal() says the size is 45k which is also strange!

I’ve tested my code with other SWF files with 2/3 frames and just an image on the last frame and it works fine.

```auto
stop();
this.onEnterFrame = function() {

var LoadedMain = Math.round(_root.getBytesLoaded());
var TotalMain = Math.round(_root.getBytesTotal());

var MainKB = Math.round(TotalMain/1024);
Percent -= (Percent-((LoadedMain/TotalMain)*100))*.25;
Percent = int(Percent);

if( LoadedMain < TotalMain ){
   
    PreloadInfo = "loading "+Percent+"% of "+MainKB+"kb";		
    stop();
}

if ( LoadedMain > 4 && LoadedMain >= TotalMain){
	//reset field
	PreloadInfo = "";

	delete this.onEnterFrame;
	gotoAndPlay(2);
}
	
}

```

I won’t post my fla just yet as there might be some conditions… What could be the problem here? It’s driving me nuts.

Thanks
