|
-
Preloader for External Swfs
Does anyone know how to do this? I am loading two external swf files into holders on a main swf. I have a preloader on the main swf and on the swf I'm calling in. When I query holder2.getBytesLoaded() on the calling (main) swf, I get NaN. The preloader in the external swf doesn't show until it's loaded.. Help!
-
Flash Guru wanna-be
Im pretty sure that getBytesLoaded() only works when you load a clip on another level not into a holder clip.
someone may want to confirm this.
Cylon
Step away from your monitor<br>go surfing!
-
Registered User
To use a preloader on an externally loaded swf, the preloader has to be in that swf, not the main movie. Then it works as a normal preloader. If the main preloader is not in it's own scene, there may be a problem. On the other hand, I have only used simple ifFrameLoaded preloaders on the external swf's I tried it on.
Last edited by iaskwhy; 10-10-2002 at 07:26 PM.
-
I tried to place the preloader on the externally loaded swf, but it doesn't show until the whole swf is loaded, showing '100% loaded of xxK' all at once after a long wait with no indication of loading.. ugh.
-
From my understanding, you can use GetBytesLoaded and GetBytesTotal with any object, i.e., [myObject].GetBytesLoaded.. etc. So I am attempting MyHolderMC.GetBytesLoaded, which seems to be working, except that it is not streaming - just going from 0K to 100K in one fell swoop. Is there anything obvious I'm missing..?
function checkLoad(){
var lBytes = main_holder2.getBytesLoaded();
var tBytes = main_holder2.getBytesTotal();
var percentLoaded = Math.floor((lBytes/tBytes)*100);
_level0.main_loader.bar._xscale = percentLoaded;
_level0.main_loader.percent.text = percentLoaded + "% of " + Math.floor(tBytes/1024) + "K loaded.";
if (lBytes>=tBytes && tBytes>0) {
if (count>=12) {
clearInterval(checkProgress);
main_holder2.gotoAndPlay("intro_play");
} else {
count++;
}
}
updateAfterEvent();
}
checkProgress = setInterval(checkLoad, 50);
main_holder2.stop();
-
getBytesLoaded() & getBytesTotal() will work from anywhere if correctly coded. You should post your preloading code or your .flas, so that we can have a look at the code.
Do you use components or linkage on the first frame in those movies?
In any case you could try my preloader in this thread:
http://www.flashkit.com/board/showth...hreadid=375161
Rid you present movie of it's own preloader!
-
Ahh, sweet victory! I got it worked out, hope it helps someone - below preloader script to track loading of external swf. Below code resides on main swf, calling external swf into a MC holder (main_holder2):
function checkLoad(){
var lBytes = main_holder2.getBytesLoaded();
var tBytes = main_holder2.getBytesTotal();
var percentLoaded = Math.floor((lBytes/tBytes)*100);
_level0.main_loader.bar._xscale = percentLoaded;
_level0.main_loader.percent.text = percentLoaded + "% of " + Math.floor(tBytes/1024) + "K loaded.";
if (lBytes>=tBytes && tBytes>0) {
if (count>=12) {
clearInterval(checkProgress);
_level0.main_holder2.nextFrame;
_level0.main_loader._visible = false;
} else {
}
}
_level0.main_holder2.updateAfterEvent();
}
checkProgress = setInterval(checkLoad, 50);
_level0.main_holder2.stop();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|