# Preloader problem using AS3.0

**URL:** https://forum.kirupa.com/t/preloader-problem-using-as3-0/292696
**Category:** flash
**Created:** [July 17, 2009, 4:56pm UTC](https://forum.kirupa.com/t/preloader-problem-using-as3-0/292696 "2009-07-17T16:56:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![valcrave](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@valcrave](https://forum.kirupa.com/u/valcrave)
#### Post date: [July 17, 2009, 4:56pm UTC](https://forum.kirupa.com/t/preloader-problem-using-as3-0/292696/1 "2009-07-17T16:56:20Z")

</div>

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.

```auto
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](http://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:

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

```

Any help is much appreciated, thanks 🙂
