Multiple Preloader with x movies (single and multiple bps and percentage)
Simply put all your movies to load and the corresponding
targets/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 targets/levels to load into
moviearray = new Array("movie1.swf","target1","movie2.swf","_level2","movie3.swf","_level99");
//set the index of the first movie to load
actMovieIdx = 0;
//set the sum of all movies by hand
allTotBytes = 122334;
//reset actual loaded Bytes
allActBytes = 0;
//set the starttime for loading all the movies
allStarttime = getTimer();
frame 2:
// get the next moviename and target/level
moviename = moviearray[actMovieIdx++];
movietarget = moviearray[actMovieIdx++];
// load the given movie
loadMovie(moviename, movietarget);
// remember the time where we started loading to calculate the bytes per second
starttime = getTimer();
frame 3:
//get the actual loaded bytes
actBytes = eval(movietarget).getBytesLoaded() || 0;
// get the total bytes to load
totBytes = eval(movietarget).getBytesTotal() || 100;
// calculate the percentage loaded
percent = Math.round(actBytes * 100 / totBytes);
// calculate the percentage loaded of all movies
allPercent = (allActBytes + actBytes ) * 100 / allTotBytes;
// calculate bytes per second loaded
bps = Math.floor(actBytes * 1000 / (getTimer() - starttime));
// calculate bytes per second of all movies loaded
allBps = Math.floor((allActBytes + actBytes) * 1000 / (getTimer() - allStarttime));
frame 4:
if( totBytes - actBytes > 10){//more bytes available, keep on loading
// calculate total bytes loaded so far
allActBytes += actBytes;
gotoAndPlay(3);
} else if(actMovieIdx < moviearray.length){//if we got more movies to load
gotoAndPlay(2);
}
frame 5:
// ready, go - here starts your movie
- Looney Date: 28/11/2001
Hi bokel! Thanks for the time-saving examples. Just one thought
though. In frame 4, it should be:
if( totBytes - actBytes > 10){
gotoAndPlay(3);
} else if(actMovieIdx < moviearray.length){
allActBytes += actBytes;
gotoAndPlay(2);
}
The line allActBytes += actBytes is in the wrong if clause.
Also, any reason why you aren't rounding up allPercent?
Cheers!
- ananth Date: 29/04/2002
hi friend,
i want some loading files,i want to load multiple movies at a time,i will clearly explain.
1.my main movie is 200kb,thats why i want split to 3 r 4 movies for fast opening.
2.when i opened main movie that time only loaded by 2,3 and 4 movies.
is it possible.i tried from loadmovie,but it is when we click the button that time only this will loading,thats why i want to when the main movie opens that time only all other movies will load.
plz tell me and send that file.
plz dont neglect i want as early as friend.
any how thanx advance.
bye
ananth
- Rashmi Date: 31/07/2002
Dear Friend,
I have tried the method given by you. But I am loading the external file in a movieclip which is inside another. So the load command is like the following
loadMovie ("Loading1.swf", "movie/Dummy");
So my script in frame 3 is like this :
//get the actual loaded bytes
actBytes = eval("movie/Dummy").getBytesLoaded();
// get the total bytes to load
totBytes = eval("movie/Dummy"+".getBytesTotal()");
// calculate the percentage loaded
percent = Math.round(actBytes * 100 / totBytes);
// calculate the percentage loaded of all movies
allPercent = actBytes * 100 / totBytes;
But this doesnot read th erequired actBytes and totBytes properly.
Please help me.
Thanks
Rashmi
- chris Date: 10/09/2002
The sintax should be ( "myswf.swf", _root.movie.dummmy)
NOT
_root.movie/dummmy
- aa Date: 13/11/2002
I am trying to load mulitple movies in the preloader. I have 5 movies to load. My question is in frame two do i need to load each movie or a single movie to begin the total download.
thx,
aa
- ass hole Date: 05/07/2003
I think you are all a bunch of assholes.
- Antonio Max Date: 07/10/2003
i just cant stop laughing at this last post. :P
- Matt Simper Date: 13/04/2004
I have an external FLV that I am in need of a preloader for.
Any suggestions? I can't seem to get any where on this matter.
MXPro is my program.
//The code to play back the flv dynamicaly.....
// Create a NetConnection object:
var netConn:NetConnection = new NetConnection();
//Create a local streaming connection
netConn.connect(null);
// Create a Net Stream object and define an onStatus Frunction:
var netStream:NetStream = new NetStream(netConn);
// Set the buffer time:
netStream.setBufferTime(5);
//Attach the NetStream video feed to the Video Object:
my_video.attachVideo(netStream);
//begin playing flv
netStream.play("newVideoFile1.flv");
Can ayone help me?
other email djsimpa23@yahoo.com
site in question http://www.quiltcut.com/45e01_typ.html
Add comment
Home