# Preloader Help Please! Not Working

**URL:** https://forum.kirupa.com/t/preloader-help-please-not-working/179303
**Category:** flash
**Created:** [February 18, 2006, 5:17pm UTC](https://forum.kirupa.com/t/preloader-help-please-not-working/179303 "2006-02-18T17:17:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![typografuk](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@typografuk](https://forum.kirupa.com/u/typografuk)
#### Post date: [February 18, 2006, 5:17pm UTC](https://forum.kirupa.com/t/preloader-help-please-not-working/179303/1 "2006-02-18T17:17:36Z")

</div>

I’m not that much of a newbie to Flash but sometimes I sure feel it.  
I have been working with the XML Photo Gallery tutorial here on [kirupa.com](http://kirupa.com)

I’ve been spinning my wheels figuring out this preloader for days so any help is greatly appreciated! [http://www.kirupa.com/forum/images/smilies/classic.gif](http://www.kirupa.com/forum/images/smilies/classic.gif)

The sample gallery online works fine, after following the tutorial my vresion works fine too, except for the preloader!

HERE IS THE PRELOADER CODE FROM THE KIRUPA TUTORIAL:  
p = 0;  
this.onEnterFrame = function() {  
filesize = picture.getBytesTotal();  
loaded = picture.getBytesLoaded();  
preloader.\_visible = true;  
trace(“filesize =” + filesize);  
trace(“loaded =” + loaded);  
if (loaded != filesize) {  
preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
preloader.\_visible = false;  
if (picture.\_alpha\<100) {  
picture.\_alpha += 10;  
}  
}  
};

I ADDED THE TRACES TO SEE WHAT WAS GOING ON - this is the result:  
filesize =4  
loaded =4  
filesize =4  
loaded =4  
filesize =4  
loaded =4  
filesize =-1  
loaded =0  
filesize =2431002  
loaded =2431002  
ad infinitum

I used a very large 2.5 meg jpeg to load so that I could see the effect.  
Instead I get a white screen, preloader not visible at all, until the file loads and then it fades in.

And yet somehow the “fading in” does not start until it is fully loaded. I would have presumed that the alpha fade would start immediately because both filesize and loaded are equal (4 & 4) from the beginning.

Thanks!
