A "quick" preloader question

hey ya’all!
I know there’s alot of threads abouts preloaders, and the answer for my question is probably out there… BUT, anyways… :slight_smile:

I’m using the following AS for a percentage preloader:

onClipEvent (enterFrame) {
  bytes =_root.getBytesTotal();
  bytes_loaded = Math.round((_root.getBytesLoaded()/bytes)* 100);
  if (bytes_loaded >= 100) {
    this.loadingtxt = "DONE";
  } else {
    this.loadingtxt = bytes_loaded;

…but it first starts counting at “22” or so… why is that!??

Are you previewing this on your computer or on the internet? If your previewing it on your computer then theres a good chance that Flash is caching your movie on your computer so its starting at 22 because its already loaded that much into your computer before you’ve even started your animation. Most likely no matter what you do your preloader will never start at 0.

Hope this helps


I’m previewing it on the web, and I know it’s to aim a bit high saying it should start from 0, but somewhere below 10 is possible! I normally use another AS when creating a percentage preloader:


if(_framesloaded == _totalframes){
nextScene ();
play ();

else {
loaded = Math.round(getBytesLoaded()/1024);
total = Math.round(getBytesTotal()/1024); 
percent = Math.round((loaded/total)*100)+"%";
bytes = loaded+"kb loaded";



this gives a great counting (allmost from 0) :wink:

but in this case it won’t work cause I’m using another AS in that scene that obviously don’t like it!..

I think the reason it starts and zero or close to with your code is because it is dependent upon the frame rate. With your code the frame rate of the movie is set at 12 frames a second where as if you use the enterFrame code it loops at 24 times a second so it will load differently. Just thought I’d ask, why do you want your preloader to load at 0 anyway that means its going to take longer to load, whatever your loading.

Hope this helps