Preloader problem using AS3.0

hi there, first of all thanks for any help, much appreciated this. I’m pretty much a novice when it comes to flash webdesign, so I don’t know a whole lot about it. This is my first real fully fledged flash website I’m currently building and I’m trying to code a preloader into the site. Now so far what I’ve got works in some way but not exactly how I intented…

When the preloader loads up, it loads to about 19.9% and the my index.swf loads immediately in the the preview and published files. here is my AS3 code for the preloader fla/swf file.

loader.addEventListener(ProgressEvent.PROGRESS, onProgress);
loader.addEventListener(Event.COMPLETE, onComplete);
function onProgress(e:ProgressEvent):void
{
 var loaded:Number = loader.bytesLoaded;
 var total:Number = loader.bytesTotal;
 preloader_mc.scaleX = loaded / total;
}
function onComplete(e:Event):void
{
 removeChild(preloader_mc);
 removeChild(outline_mc);
}

I followed this from LearnFlash.com so there shouldn’t be any reason why this shouldn’t work, surely? oh I also used the UILoader on the page aswell and set the parameters for it as thus:

autoload: True
maintainAspectRatio:True
scaleContent:False
source:index.swf

Any help is much appreciated, thanks :slight_smile: