If I were to load five of the same movie at the same time (into five different targets)...is it smart enough to only load the data once or will it be accessing the KB separately for each movie?
For instance:
NAVIGATION.swf (30kb)
is loaded into 5 different targets at the same time....
So will 30kb be downloaded or will 150kb be downloaded? If that's the case, of course I'll need to first load one "navigation.swf" and then load the other 4 after the file is cached.
Please help. And please let me know if I'm not making sense (it happens)...
interesting....hard to say.
my guess is that flash would probably load the movies one at a time anyway, even if all five are called at the same time (not sure on this) and it would probably automatically cache the first stream and use it for the others.
are the movies going into movieclips?....if so what i might do is load the movie once, then run duplicateMovieClip() to get the others.
hope this helps!
How best to evaluate if the SWF is fully loaded into HOLDER1 and ready to be duplicated into HOLDER2, HOLDER3, HOLDER4, HOLDER5.....?
I've never used duplicate movieclip before. I thought it was just for flash math nerds!
.....
to answer your original question:
click here:
http://www.protosite.net/crap/tests/loading_test_kid_capri3.html
there's 5 clips loading the same exact thing... appears to take place one at a time, and each load takes just as long as the other one... this is because the load calls started at the same time...
here's the code:
Load_test=function(x,y,path,depth){ this.x=x; this.y=y; this.path=path; this.depth=depth; this.init(); }
Load_test.prototype.init=function(){ this.clip=_root.createEmptyMovieClip("c"+this.depth,this.depth); this.clip._x=this.x; this.clip._y=this.y; this.clip.createTextField("stat",1,0,0,200,20); this.clip.createTextField("time",2,0,25,200,20); this.clip.createEmptyMovieClip("holder",3); this.clip.holder.loadMovie(this.path); this.clip.start_time=getTimer(); this.clip.onEnterFrame=function(){ var loade=this.holder.getBytesLoaded(); var tot=this.holder.getBytesTotal(); this.stat.text="precent loaded : "+(Math.round((loade/tot)*100))+"%"; this.time.text="loading time : "+(getTimer()-this.start_time); if(loade>100 and loade==tot){ this.holder.removeMovieClip(); this.onEnterFrame=null; } } }
for(i=0;i<5;i++){ _root["l"+i]=new Load_test(50,50*i,"my_boyz.jpg",i); }
now, if you alter the above code slightly (well, only the last bit):
Load_test=function(x,y,path,depth){ this.x=x; this.y=y; this.path=path; this.depth=depth; this.busy=true; this.init(); }
Load_test.prototype.init=function(){ this.clip=_root.createEmptyMovieClip("c"+this.depth,this.depth); this.clip._x=this.x; this.clip._y=this.y; this.clip.createTextField("stat",1,0,0,200,20); this.clip.createTextField("time",2,0,25,200,20); this.clip.createEmptyMovieClip("holder",3); this.clip.holder.loadMovie(this.path); this.clip.start_time=getTimer(); this.clip.parent=this; this.clip.onEnterFrame=function(){ var loade=this.holder.getBytesLoaded(); var tot=this.holder.getBytesTotal(); this.stat.text="precent loaded : "+(Math.round((loade/tot)*100))+"%"; this.time.text="loading time : "+(getTimer()-this.start_time); if(loade>100 and loade==tot){ this.holder.removeMovieClip(); this.parent.busy=false; this.onEnterFrame=null; } } }
cur=0; tot=5; holder; onEnterFrame=function(){ if(!holder.busy){ if(cur<tot){ holder=new Load_test(50,50*cur,"my_boyz.jpg",cur); cur++; }else{ onEnterFrame=null; } } }
(see it in action here) http://www.protosite.net/crap/tests/loading_test_kid_capri4.html
here the first time it loads it takes a while, the rest load it from the cache...
so, the idea is to load it once. As soon as it has finished loading, you can load it as many times as you want "semi-instantly" from your cache...
as for your second question, you can't use duplicate movieclip and expect a loaded clip to duplicate... you need to duplicate an empty clip, and tell it to loadMovie()... from the cache of course..
and who you calling a nerd :swear::swear::swear::swear:

Dont know if you are working in MX but..
If the contents of the navigation.swf were not on the time line but instead available as a library MoviClip available for actionscript.. couldn't you then load the navigation.swf and call attachMovie("whatever",mcYouWantToLoadItInTo); to avoid going to browser cache? Don't even know if this would make that great of a performance change, but in theory the library item is already loaded into memory within the flashplayer so..
:shrug:
Ah....thanks guys.......I will just daisy chain them ghetto style!...very good to know though..........thanks for that excellent test method Sakri. I am on a network here and it is nearly impossible to properly test D/Ls.......
Oh...and I was calling you a nerd, Sakri, you and you alone! Looking at all that code just to load some damned SWFs I'd say it's well deserved too!!!!!!
