# as3 loader

**URL:** <https://forum.kirupa.com/t/as3-loader/279747>\
**Category:** flash\
**Created:** [January 18, 2009, 9:25pm UTC](https://forum.kirupa.com/t/as3-loader/279747 "2009-01-18T21:25:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![altedious](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@altedious](https://forum.kirupa.com/u/altedious)\
**Post date:** [January 18, 2009, 9:25pm UTC](https://forum.kirupa.com/t/as3-loader/279747/1 "2009-01-18T21:25:06Z")

</div>

hello,  
i just setup this loader i found on the net:

```auto
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("world.jpg"));

function loop(e:ProgressEvent):void{
    var perc:Number = e.bytesLoaded / e.bytesTotal;
    percent.text = Math.ceil(perc*100).toString();
}

function done(e:Event):void{
    removeChildAt(0);
    percent = null;
    addChild(l);
}

```

what i dont understand is that everytime i click the refresh page the loader shows up again(this time loading the image faster) but if the image is already in cache the loader should not show at all (?), i would like to achieve a loader that loads the image and after dont come up again everytime.
