Groups | Blog | Home
all groups > flash actionscript > june 2004 >

flash actionscript : Please help! Problems with a simple preloader!


chowin
6/19/2004 7:48:51 PM
I?ve tried everything and I desperately need some help with my preloader. It?s
a simple preloader about ten frames long with a simple loading animation and a
display of the percentage complete. The problem is that it?s constantly
loading the entire movie (about 300 frames) when I just want it to load all the
frames up to 173. But I also want it to accurately display the percentage
complete. HELP! Here?s the actionscript I?ve been trying to use?


First frame of loading sequence:


loadpercent = "0%";



--------------------------------------------------------------------------------
-----------------------


Last frame of loading sequence:


loadPercent = (Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() *
100) + "%");

if (_root.getBytesLoaded() == _root.getBytesTotal()){
loadPercent = "100%";

ifFrameLoaded (207)
gotoAndPlay (12);
} else {
gotoAndPlay (3)
}



Is there something missing? Should I use different code? Please HELP!

kglad
6/19/2004 10:01:23 PM
loadPercent = (Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() *
100) + "%");

if(_framesloaded>=173){
gotoAndPlay (12); <------ First Frame of Movie
} else {
gotoAndPlay (3) <------ First Frame of preloader
}
chowin
6/19/2004 10:37:36 PM
Thank you for responding! But if you could elaborate? Are you saying I should
omit the following script?

if (_root.getBytesLoaded() == _root.getBytesTotal()){
loadPercent = "100%";

I?ll try it with and without. Would you say everything is ok with first frame
script as well?

kglad
6/19/2004 10:52:10 PM
your code in the first frame is superfluous. you could just paste the code
below in your 3rd frame and put a gotoAndPlay(3) in the last frame of your
preloader (which is frame 11?):

loadPercent = (Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() *
100) + " %");
if(_framesloaded>=173){
gotoAndPlay (12);
}

chowin
6/19/2004 11:21:59 PM
Ok, so I've tried what you suggested, but when I tested the movie the
percentage number stays at 0%. Lets make sure I've entered everything
correctly...

First frame of loading sequence:

loadPercent = (Math.floor (_root.getBytesLoaded() / _root.getBytesTotal() *
100) + " %");
if(_framesloaded>=173){
gotoAndPlay (12);
}

Last frame in loading sequence:

gotoAndPlay (3);

I also have the Dynamic text box with a variable labled "loadPercent". Have
I forgotten anything? One thing I need to mention is that I use Flash 5.
AddThis Social Bookmark Button