View Full Version : Load a bunch of .swf's
BagOfFun
11-19-2005, 12:10 AM
I’ve read around about preloaders here.
But it I can’t figure this one out…
The answer might be right in front of me…but I can't find it.
I want to make a preloader that loads a bunch of .swf’s.
.swf1, .swf2, swf3 etc.
And when done loading start the presentation.
- When done loading start .swf1
How do I do this?
Krane
11-19-2005, 03:18 AM
Insert 3 frames in your presentation:
in the 1st frame of the main movie:
this.createEmptyMovieClip("mov1", 2);
this.createEmptyMovieClip("mov2", 3);
this.createEmptyMovieClip("mov3", 4);
this.createEmptyMovieClip("mov4", 5);
this.createEmptyMovieClip("mov5", 6);
this.createEmptyMovieClip("mov6", 7);
this.createEmptyMovieClip("mov7", 8);
this.createEmptyMovieClip("mov8", 9);
mov1._alpha = 0;
mov2._alpha = 0;
mov3._alpha = 0;
mov4._alpha = 0;
mov5._alpha = 0;
mov6._alpha = 0;
mov7._alpha = 0;
mov8._alpha = 0;
mov1.loadMovie("index1.swf");
mov2.loadMovie("index2.swf");
mov3.loadMovie("index3.swf");
mov4.loadMovie("index4.swf");
mov5.loadMovie("index5.swf");
mov6.loadMovie("index6.swf");
mov7.loadMovie("index7.swf");
mov8.loadMovie("index8.swf");
this.onEnterFrame = function() {
percent1 = (this.mov1.getBytesLoaded()/this.mov1.getBytesTotal())*100;
percent2 = (this.mov2.getBytesLoaded()/this.mov2.getBytesTotal())*100;
percent3 = (this.mov3.getBytesLoaded()/this.mov3.getBytesTotal())*100;
percent4 = (this.mov4.getBytesLoaded()/this.mov4.getBytesTotal())*100;
percent5 = (this.mov5.getBytesLoaded()/this.mov5.getBytesTotal())*100;
percent6 = (this.mov6.getBytesLoaded()/this.mov6.getBytesTotal())*100;
percent7 = (this.mov7.getBytesLoaded()/this.mov7.getBytesTotal())*100;
percent8 = (this.mov8.getBytesLoaded()/this.mov8.getBytesTotal())*100;
mov1.stop();
mov2.stop();
mov3.stop();
mov4.stop();
mov5.stop();
mov6.stop();
mov7.stop();
mov8.stop();
};
stop();
On the 3rd frame:
if (percent1 == 100 && percent2 == 100 && percent3 == 100 && percent4 == 100 && percent5 == 100 && percent6 == 100 && percent7 == 100 && percent8 == 100) {
gotoAndPlay(4);
} else {
gotoAndPlay(2);
}
For 8 movies.
oldnewbie
11-19-2005, 03:48 AM
With a stop(); action on frame 1, I fail to see how the playhead will ever move to frame 2 or 3?
BagOfFun
11-19-2005, 08:52 AM
humms, if it's true as you oldnewbie says...do you know a way to do this?
and I also want to preload two mp3's, is it any diffrent from loading swf's?
shassouneh
11-19-2005, 11:10 AM
With a stop(); action on frame 1, I fail to see how the playhead will ever move to frame 2 or 3?
The playhead doesn't need to go to frame 2 or 3. Remmeber: Each movie clip has its OWN timeline which is somewhat independant of the main/root timeline. :D :)
You can easily have a stop action on frame 1 and do all your nasty work and frame moving inside movie clips :P
Also, just because there is a sotp action on frame 1 DOES NOT MEAN the playhead cannot move forward. It can always be advanced with a gotoAndStop() or a gotoAndPlay() action ;)
BagOfFun
11-19-2005, 11:29 AM
I don't know why, but the whole screen goes white...
I just simply want the user to download all the swf's to it's temp internet files so it the whole thing works.
oldnewbie
11-19-2005, 01:43 PM
The playhead doesn't need to go to frame 2 or 3. Remmeber: Each movie clip has its OWN timeline which is somewhat independant of the main/root timeline. :D :)
Ummmmmmmh! I pretty well know that! The whole point I was trying to make, is that as coded & posted (not how it could be coded to work...), the suggested code wouldn't work... You'd need to check if all movies were in fact fully loaded within the onEnterFrame on the first frame, to then allow the playhead to move to frame 4...
And then, since all movies are set at alpha 0, and stopped on their first frames, you would need to reset their alphas and start them up in the appropriate order...
BagOfFun... How many of these movies do you want to preload? What's their average weigth in bytes? Do you want one progressbar for all movies, or individual ones?
I have to go out, but later I can further help you out on this, 'cause it's definately possible.
BagOfFun
11-19-2005, 02:20 PM
Well it was supposed to be a presentation on a CD, but then I decided to put it out as a website…since downloading and extracting seems too advanced for most user of this presentation.
I’ve compressed the presentation to 4.95mb (19 swf's, haha got a bit shocked there myself), and published the swf’s to 6.0 versions of the flash player (since I guess 6.0 is the standard on web now, right?). And I know 4.95 might be too big and a preloader for each swf’s could be an idea, but the presentation is meant for broadband users.
So I guess that a loading time of 1-5 minutes is an okay deal.
I really just want one big loading screen that loads down all the swf’s at once.
(I’ve read around and all I can find is preload frames within the swf).
It would be nice with a preloader that tells the reaming time and percent of the download, but that’s not necessary.
I also got an mp3 (included in the 4.95mb) that loops (just 160kb).
I’m just wondering if the script for preloading the swf’s would be the same as preloading an mp3.
Sorry if I made the text so long, I just wanted to describe my problem accurate so there’s no misunderstanding =)
And a big thanks for spending time on this oldnewbie*
oldnewbie
11-19-2005, 02:39 PM
4.95mb, is that the size of the whole presentation, including the 19 external .swfs, or of just your main interface?
BagOfFun
11-19-2005, 02:41 PM
everything =)
the main interface is just 52kb
oldnewbie
11-19-2005, 02:52 PM
Ok! So going out in few minutes... But will be back later.
Can you provide you main interface's .fla, and maybe links to the loaded .swfs (no .flas)?
Or if you don't want to make the links public, I'll PM you an address, so that you can mail the stuff to me.
Catch you later.
Krane
11-20-2005, 12:50 AM
With a stop(); action on frame 1, I fail to see how the playhead will ever move to frame 2 or 3?
That's true:o , i apologize for the mistake, I just copied and paste from a script, but I think the whole idea is there, create a movieclip and load the swf there, it will be loaded into the temp files.
Hope that helps.
oldnewbie
11-20-2005, 12:54 AM
Now my only hope is that Shassouneh understands the same thing! :rolleyes:
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.