Multiple Preloader with x movies loaded to levels

Simply put all your movies to load and the corresponding levels in the array moviearray. Remember: If you don\'t want the loaded clips to start immediatly after beeing loaded, you have to place a stop action in the first frame of the movie. frame 1: //provide a list with all your movies to load and the levels to load into moviearray = new Array("movie1.swf",1,"movie2.swf",2,"movie3.swf",3); //set the index of the first movie to load actMovieIdx = 0; frame 2: // get the next moviename and level moviename = moviearray[actMovieIdx++]; movielevel = moviearray[actMovieIdx++]; // load the given movie loadMovieNum(moviename, movielevel); frame 3: // nothing in here frame 4: //get the actual loaded bytes actBytes = eval("_level" add movielevel).getBytesLoaded() || 0; // get the total bytes to load totBytes = eval("_level" add movielevel).getBytesTotal() || 100; // calculate the percentage loaded percent = Math.round(actBytes * 100 / totBytes); if( totBytes - actBytes > 10){//more bytes available, keep on loading gotoAndPlay(3); } else if(actMovieIdx < moviearray.length){//if we got more movies to load gotoAndPlay(2); } // else go to frame 5 frame 5: // ready, go - here starts your movie
Anuradha Date: 27/05/2001

Hi: I made use of your script to preload around 16 swfs into a main swf, in different levels. It works fine on my hard disk and I tested the logic too and everything seems perfect. Yet, when my design is tested on the web, the transition from one swf to another is not immediate which is what i wanted in the first place when i preloaded the swfs. Where am i going wrong? Would greatly appreciate your help. Thanks. Regards Anuradha
Joppe Date: 09/10/2001

Hello, I have the same problem and I think I have the work around. I was looking for an answer why my preloading loop was interrupted while the movie wasn\'t preloaded at all. At the site http://www.moock.org I found the following: \"We cannot access an externally loaded movie’s properties or methods ....\" something like this can also be found in the books of Friends Of ED. So when you ask the properties of a movie that is loading you get I think something like \"Undefined\". So I think you have to put some actions in the movie that is loading, these actions check if the current movie is totaly loaded, if so then control _level0 to do some actions, if not stay loading. Another solution might be the loading of a swf in an empty MovieClip, these properties can be accessed. ((this.getByteLoaded==this.getBytesTotal)&&(this.getBytesTotal!=0)) Bye, Joppe
jlkjl Date: 26/10/2001

why doesnt this
Mr. X Date: 25/01/2002
Excellent stuff!
ananth Date: 04/06/2002
hi, am also facing same problem,when i loaded exter 20 swf's into main,its taking same to load when i keep loadmovie action,its not loading backend,please if any body tell me what's the problem are send the that multiple loading in backend when the main movie loades that time only loades all other remaing 20 files. plz if any body send me that sample.am very thankful to u. bye ananth www.infobiquity.com
Tekraj Sharma Date: 30/07/2002
Hi this is good. is there any way to preload symbols and Mc from a shared library. without having to load the swf into a level or target. cheers Tekraj
Saran Date: 16/11/2002
Hai... I have a doubt...it is like this... 1) I want to load a sequence of movies(swf) in to a flash stage during runtime. 2)The first movie must appear on the screen but the remaining movies must be in the cache memory. 3) Once the user wishes to go to the next frame the next movie in the cache must come in to stage. 4)To check the bytes loaded I used the "_level" option.But while I am using "_level" option..I couln't play with the visibility factor of the movie. The thing I want is "to hide a level temporarily and then unhide that upon my wish".. Can anybody help me out in this? with regs, .Dj.
Giancarlo Date: 17/11/2002
Cool!... Thanks!
ShivKiran Date: 19/12/2002
this is kewl as a idea. ..let me seee if it is working and get back to you . Thanks anyways
Lori Date: 27/02/2003
Which frame do you insert a "please wait...loading" animation?
Federico Gonzalez Date: 02/05/2003
Thank, itīs an excelent example
diabolik Date: 10/07/2003
Some general thoughts when loading into levels, say _level(2);. In this example each new movie replaces the other on level 2 only. Place a universal loader on, say frame 40. when the load button is activated from frame 1, it's first action on release should be to unload anything already on level 2, clear any interval that may be running, load the new movie then play()the timeline stopping on the preloader frame (40). The 40 frames of play allow time for the unload to happen and the new data to begin before the loader gets activated which helps eliminate "NAN" in your number text field. Example button: button.on(release) { unloadMovieNum(2); clearInterval(time); loadMovieNum(movie.swf, 2); play(); } When the loader says loading is complete it should clear the Interval and send the play head back to frame 1. However if a different button, say a menu button is clicked during the loading of a movie before it completes it may have a bizarre result as I found, throwing the movie into chaos. The idea should be to get the movie out of the preloader frame (40) first then clearing the Interval, unloading the current movie, then navigating to the new frame (menu). As most examples go, this may be too specific for your project but the theory of dealing with the current state of the movie before performing other actions is a general one.
FlashMan Date: 19/08/2003
Hi. I don't know for sure if this is the correct preloader for me to use. Here's what I want to do: I have in my main movie on the main stage, a movie clip that goes to one of 5 frames depending on which one of the 5 buttons on the main stage is clicked. Also, on each of these 5 frames is both a photo on one layer and an external SWF that loads onto level 1 on another layer. The problem, is that I don't know how to get a preloader for these external SWF's to show up - as it is now, there's just dead waiting time as the external SWF loads. Please help!!!
dave Date: 20/09/2003
I'm using your "multiple preloader with x movies loaded to levels", and it works! It's nice to find something that both works and is easy to use. I'm preloading 8 swf files, and it works fine. I've got a request - can you tell me how I can add a loader bar to to your script, that shows me the percentage of total bytes loaded (i.e the percentage of the total bytes of all the loaded swfs combined)? If you could solve this I'd be enternally grateful. Many thanks, Dave
Ed Date: 15/11/2003
I have 2 swf movies. I want to load the first and when fully played, to have the second loaded. There are no buttons; it all must be automatic. In frame 1: loadMovieNum("Slides01-05.swf",10); Frame 2 is labeled: loop1 Frame 3: if (_level10.getBytesLoaded()<_level10.getBytesTotal()){ gotoAndPlay("loop1"); } else { play(); } Frame 4 is labeled: loop2 Frame 5: if (_level10._currentframe<_level10._totalframes){ gotoAndPlay("loop2"); } else { unloadMovieNum(10); gotoAndPlay("loop2");} I can't get rid of movie 1 in order to load movie 2. Where is the code wrong here?
Alek Date: 27/01/2004
I load 10 swf in the begining .. but they all play in the same time after they are loaded ... where i should put STOP action. In my MAIN SWF or in the SWF's that i'm loading??? I add stop action in the first frame of the main SWF but it wont work .... Please let me know. Alek
Sen Date: 22/06/2004
I tried, your coding to preload some 6 swf movies in my website, i added a text box named Text1, frame 4 : //get the actual loaded bytes actBytes = eval("_level" add movielevel).getBytesLoaded() || 0; // get the total bytes to load totBytes = eval("_level" add movielevel).getBytesTotal() || 100; // calculate the percentage loaded percent = Math.round(actBytes * 100 / totBytes); Text1=percent; if( totBytes - actBytes > 10) {//more bytes available, keep on loading gotoAndPlay(3); } if(actMovieIdx < moviearray.length) {//if we got more movies to load gotoAndPlay(2); } else { gotoAndPlay(5); } but its not working, anyone pls help me out, iam struck up with this Thanx
ameuta Date: 11/09/2007
**Error** Scene=Scene 1, layer=Layer 1, frame=3:Line 1: Unexpected '/' encountered /get the actual loaded bytes Total ActionScript Errors: 1 Reported Errors: 1
Pivo Date: 29/11/2008
Hi...on the 3 frame , 2nd line end 4th line this error ')' or ',' expected what is wrong? i used your script
himanshu Date: 17/04/2009
i have a problem in flash sequence link_1, link_2, link_3, link_4, link_5, link_6 these are my buttons i can call all the external swf files by these buttons i want a play one sequence of all the external swf files in one loader . myloader.contentPath = "etracs_front.swf"; link_1.onRelease = function() { myloader.contentPath = "etracs.swf"; }; link_2.onRelease = function() { myloader.contentPath = "studyabroad.swf"; }; link_3.onRelease = function() { myloader.contentPath = "login.swf"; }; link_4.onRelease = function() { myloader.contentPath = "account.swf"; }; link_5.onRelease = function() { myloader.contentPath = "personal.swf"; }; link_6.onRelease = function() { myloader.contentPath = "experience&education.swf"; };
luis Date: 18/10/2009
great stuff, iīve been looking for a preloader with no delay for a long time, this is perfect i add some code to see the progress of the movie in frame 4 this.bar.gotoAndStop(percent); in frame 3 add a dynamictext and label the variable as -percent- and make a movie clip with your progress bar in 100 frames and label it as -bar- hope itīs usefull for someone
Add comment
Home