PDA

View Full Version : SWF Preloader within a SWF within a SWF x&*%


sambob
12-04-2003, 04:39 AM
If you have a preloader (as per this site) ie...

onClipEvent (enterFrame) {
loading = _parent.getBytesLoaded();
total = _parent.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per*1.5;
if (percent>99) {
_parent.gotoAndStop(2);
}
}

Does it matter if it is being loaded into another SWf (at a level)..

For some reason my preloader within for a SWF being loaded into upper levels hangs and then loads after a delay (the delay which the preload should be Preloading)

This is driving me MAD!!!..

Check out what I mean at my WEBSITE (http://www.lumieres.com.au)

Thanks

JHallam
12-04-2003, 07:30 AM
Hey,
put a empty movieClip on your level where you'd like the other .SWF to be loaded into, give the empty mc the instance of "content"

then on your other .SWF, put this action on the first frame.


this.onEnterFrame = function() {
if (this.getBytesLoaded()<this.getBytesTotal()) {
Total = this.getBytesTotal()/1000;
Received = this.getBytesLoaded()/1000;
Percentage = (Received/Total)*100;

_root.content.loadBar.gotoAndStop(int(Percentage)) ;
trace(_root.content.loadBar._currentframe);
} else {
_root.WorkContent.play();

this.onEnterFrame = null;
}
};


Obviously, the loadBar is the bar and the rest is the text to show the percentage etc, they all have to be in with the preloader in the external .SWF your loading in, which the code above is within.

Hope that helps.