hi guys
this is my first time posting here, but man this place has helped a newbie like me a bunch! excellent site.
heres the problem im having:
im loading external swf’s into an empty movie clip (called container2) into the main timeline, but the loading bar (the mc is called preload) does not scale at all nor it shows when the bytes loaded are more than 1 (i’ve tested it using the show streaming option when testing the movie).
the script i wrote seems to be working , cause it traces the total bytes loaded in the output window…
most of the preloaders / tutorials i’ve seen use 3 keyframes, my main movie is 1 keyframe long, i don’t know if this has anything to do with it.
heres the script:
preload.onEnterFrame = function() {
//setup variables
var Bload = _root.container2.getBytesLoaded();
var Btotal = _root.container2.getBytesTotal();
var Bpercentage = Math.round((load/total)*100);
//tell the preload bar to scale
_root.preload._xscale = Bpercentage;
//make bar visible / invisible
if ((Bpercentage == 100) ) {
delete this.onEnterFrame;
preload._visible=0;
}else {
if (Bpercentage >= 1){
preload._visible=100;
}
}
trace (Bload);
};
stop ();
sorry for the super long post and thanks in advance!
coche
thanks guys for the replies
scotty thanks for the *watch the B’s…so embarrasing i got excited for a second thinking that was gonna do it but it didnt.
kennyb, its kind of a big fla file (1+ meg), is there somewhere i can send it to for you to take a look? - sorry for the super long delay
now i have my doubts over this script working at all … just created 2 dyn text fields with var names Bload and Btotal and they dont even show…
how can i visualize how much is being loaded to make sure it is in fact getting the data? the output window is only showing me the total bytes, not the progress…any ideas?
thanks!
coche
hey kenny,
i just sent you my fla file as you *requested * earlier today
sorry its taken me so long, havent been around much.
there are 2 scripts in the actions kf …one i wrote and one tutorial i found…none of them work dont know whats going on with this preloader arghghgg!!!
anyways thanks a bunch in advance
I couldn’t find where you were loading your external files into containers. However, I see a challenge you face. You want to preload two external swf’s at the same time, as well as the rest of your movie - right?
Perhaps the easiest this is to preload on in the first frame and the second in the second frame. While I’ve never tried to simultaneously load multiple swf’s and the main movie, here’s some code that seems to work. There are components for doing this, but I’ve not used them either.
//
if (loadedVar!=1) {
loadedVar=1;
_root.container1.loadMovie(“azoia.swf”);
_root.container2.loadMovie(“tarkovsky.swf”);
}
//
_root.file1Total=Math.round(_root.container1.getBytesTotal());
_root.file2Total=Math.round(_root.container2.getBytesTotal());
_root.file3Total=Math.round(_root.getBytesTotal());
_root.myTotal = Math.round((_root.file1Total + _root.file2Total +_root.file3Total)); //also updates text box on page
//
_root.file1BytesLoaded=Math.round(_root.container1.getBytesLoaded());
_root.file2BytesLoaded=Math.round(_root.container2.getBytesLoaded());
_root.file3BytesLoaded=Math.round(_root.getBytesLoaded());
_root.myBytesLoaded = Math.round((_root.file1BytesLoaded + _root.file2BytesLoaded + _root.file3BytesLoaded));
//
if (loadBarPercent<1 || loadBarPercent==nul) {
_root.loadBarPercent=0
}
_root.loadBarPercent2 = _root.myBytesLoaded / _root.myTotal;
_root.loadBarPercent=Math.round(_root.loadBarPercent2*100);
_root.loadPercent = _root.myBytesLoaded; //also updates text box on page
_root.loadbar2._xscale=_root.loadBarPercent;
//
Here’s your movie using that code. I just advanced it far enough that you can see the preloader work.
the first scene called preload is just the preload for the entire movie (thats the first preloading bar you see when it opens, the one that ACTUALLY works.). after it loads it sends you then to the main scene, thats where the preloading should occur when hitting a button inside the menu.
then its just simple loading of different swf’s , at different times, into the same empty movie clip. once you hit a button it loads an swf like the one i attached, then, when clicking another button (for a diff project inside the scroll menu ) that swf turns off and another swf is loaded. heres where i need the percentage preloader, cause the screen is becoming black and it looks like nothing is coming up.
the files are bieng loaded from way way way down inside movie clips…this is the code ive got in each button:
i uploaded the incomplete site just as a test: www.aumstudio.org.
click on aum ->competitions -> namjune and wait a couple secs for the swf to load, then go in the menu to house for tarkovsky and click it, wait for it to load again, etc…thats where the preloaders should be, for each swf that is loaded into the same container at diff. times.
its just like what happens in the www.fontsforflash.com site every time you click a button, thats the clearest example i can think of.
this should be simpleeeeeeeeee!
c