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
[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);
}
}