loading in flash: help
- Started
- Last post
- 18 Responses
- goygoygoy
I've got this code on frame 1, frame 2 is empty, so when loaded it goes on the next scene :
this.onEnterFrame = function() {
totalcarga = getBytesTotal();
encargo = getBytesLoaded();
porcentaje = Math.round((encargo*100)/totalca...
cargado = porcentaje+" %";
barreloader.niveau._xscale = porcentaje;
if (encargo == totalcarga) {
gotoAndPlay(2);
}
};
The problem is that my loading bar appears only when the movie is almost loaded. (like 90%). How can I fix that?
- ozhanlion0
maybe because you are loading everythinh on first frame, it is always better to put a blank mc on the first frame, and put the preloader code inside. Remove anything else on frame one Thus, your preloader begins just from the beginning.
- goygoygoy0
thks i'll check this out.
Actually I alredy tried it with the code on a empty MC but frame 1 had other content like the loading level stuff.
- ozhanlion0
loading level stuff ?
I am sure putting them on frame 3 won't do harm.
- stewart0
preload the preloader...
- goygoygoy0
stewart, preview your thread before you load it! and ya'll see how stupid it looks
:)
just djowking
- unfittoprint0
if you have symbols in the library with a link ID, they will be exported on the 1st frame before anything else. If this is the case, the best thing is having a preloader movie [another file] calling [externally] your content swf.
Oh, use setInterval rather than onEnterFrame...
- goygoygoy0
thks unfit that's good info, & didn't know about setInterval thing.
- mirola0
also, make sure that your peloader text only has the characters that you need embedded, i.e. 0123456789%
- goygoygoy0
how can I get the BytesTotal of an external swf?
- unfittoprint0
you could make something like:
this.createEmptyMovieClip("conte... 5);
checkLoad = function(){
if(contentMC.getBytesLoaded() == contentMC.getBytesTotal()){
clearInterval(loadLoop);
} else {
textBox.text = (contentMC.getBytesLoaded()/cont...
}
};contentMC.load("content.swf");
loadLoop = setInterval(this, "checkLoad", 30);
and like mirola said, see if you're not using unnecessary embed caracthers in your loader's text...
- mirola0
i think fonts are the only thing you cant stop from loading before the first frame
- goygoygoy0
thks man, it helps a lot
- goygoygoy0
actually a have a lot of sounds loading in first frame by linkage from lib... and a few embed texts.
- goygoygoy0
apparently it understand that if (contentMC.getBytesLoaded() == contentMC.getBytesTotal())
is true on first loop (0=0)
and on second loop= (totalMovie=totalMovie) so contentMC.getBytesLoaded() doesn't work...
do you see what's wrong?
- unfittoprint0
#1 well I forgot to put a stop() at the end of my code.
#2 I don't understand what totalMovie is...
#3 you can add stuff to to the first boolean equation, ie. text=100%...
#4 if you're testing offline thing will load much faster than online, so it may seem that isn't working. You can simulate smaller bandwidth offline by using stuff like WebSpeed Simulator [ http://xat.com/wo/index.html ].
- goygoygoy0
okay unfit it works, thks again for your help.
the setInterval thing is really good. :)
- unfittoprint0
the nice thing about is that you can speed/slow it regardless of the frame rate. see the 30 number? That's the means 30 milliseconds, +- 33 fps....
- goygoygoy0
yep I digged it, nice.