PDA

View Full Version : swf preloading method efficiency


h4x0r404
12-30-2007, 03:34 AM
Say I'm loading a swf in an empty movie clip. When using a preloader, it actually loads the elements on the first frame of the swf. Am I right? Are there any methods of loading multiple frames at once?
And, if I already have an instance of a movie clip on the stage on frame 1 (so it's preloaded) and the second frame contains the same movie clip, does it need to load again or it's been already loaded?

Thanks.

acolyte
02-24-2008, 07:39 PM
Hi h4x0r404,

to ensure that everything is loaded in your external .swf you can use a scene preloader
emagine preparing your external swf with a preload scene and a content scene on the content scene you place a variable loadStatus = true
where in the preload scene you do something like :


total_bytes = this.getBytesTotal();
loaded_bytes = this.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded ("content",1) {
gotoAndStop("content",1);
}
_root.loadStatus = false;


you can also use MovieClipLoader for this , i dont know what codestandart you are trying to use


hope this helps

rpoy
02-27-2008, 04:05 PM
Hi!

I have been using this basic method for a preloader:

total_bytes = this.getBytesTotal();
loaded_bytes = this.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded ("content",1) {
gotoAndStop("content",1);
}
_root.loadStatus = false;


Which works well I think, but from what I understand the newer way is using the MovieClipLoader.

I read somewhere on this site that there may be issues with the MovieClipLoader. So I was just wondering what you guys thought the advantages / disadvantages are for each method. It seems like the MovieClipLoader, in theory at least, is better and offers more flexibility.

I thought these articles were really good...
http://www.sitepoint.com/article/structure-flash-site
http://www.sitepoint.com/article/steps-faster-flash

atomic
02-27-2008, 04:07 PM
Ask Xxneon about it! ;)