# Preload bar gone funky - two SWFs

**URL:** <https://forum.kirupa.com/t/preload-bar-gone-funky-two-swfs/82201>\
**Category:** flash\
**Created:** [March 8, 2005, 2:02pm UTC](https://forum.kirupa.com/t/preload-bar-gone-funky-two-swfs/82201 "2005-03-08T14:02:18Z")\
**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:** [March 8, 2005, 2:02pm UTC](https://forum.kirupa.com/t/preload-bar-gone-funky-two-swfs/82201/1 "2005-03-08T14:02:18Z")

</div>

Before my SWF loads, on the first frame, I am loading the root SWF and another. They both preload just fine but the preloader bar is weird. I have attached the code and two images to try and describe what happens:

Firstly, the bar and percent only represent the root SWF, when that reaches 100%, the file size changes to combine both the SWF (84k), the bar returns to roughly 50% (the first SWF being loaded) and it preloaded the both.

Can anyone find what it going wrong? Cheers

```auto

[COLOR=Blue]_root.[/COLOR]container.[COLOR=Blue]loadMovie[/COLOR]("home.swf");

stop();

[COLOR=Blue]_root.onEnterFrame[/COLOR] = function() {
**[COLOR=Red]//These total & loaded vars represent the external SWF, TotalHome doesn't get the Bytes at the start???[/COLOR]**
var TotalHome = Math.round(_root. **container**.getBytesTotal());
var LoadedHome = Math.round(_root. **container**.getBytesLoaded());

var TotalMain = Math.round([COLOR=Blue]_root.getBytesTotal()[/COLOR]);
var LoadedMain = Math.round([COLOR=Blue]_root.getBytesLoaded()[/COLOR]);

var SiteTotal = TotalHome + TotalMain;
var SiteLoaded = LoadedHome + LoadedMain; 

var TotalKB = Math.round(TotalMain/1024) + Math.round(TotalHome/1024);
Percent -= (Percent-((SiteLoaded/SiteTotal)*100))*.25;
Percent = int(Percent);

    PreloadInfo = "loading "+Percent+"% of "+TotalKB+"kb";		
	//load bar expands as image loads
	//* Bar should not appear full at the start!
    PreLoadContainer.attachMovie("SiteLoadBar","SiteLoadBar",10);
    PreLoadContainer.SiteLoadBar._width = 1.5 * Percent;

if ( LoadedHome > 4 && SiteLoaded >= SiteTotal && LoadedMain > 4 && LoadedMain >= TotalMain){
	//reset field	
	PreloadInfo = "";
	PreLoadContainer.SiteLoadBar.removeMovieClip();	   

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

```
