# Preloader problem

**URL:** <https://forum.kirupa.com/t/preloader-problem/273419>\
**Category:** Uncategorized\
**Created:** [October 15, 2008, 11:43am UTC](https://forum.kirupa.com/t/preloader-problem/273419 "2008-10-15T11:43:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vxd](https://avatars.discourse-cdn.com/v4/letter/v/848f3c/32.png) [@vxd](https://forum.kirupa.com/u/vxd)\
**Post date:** [October 15, 2008, 11:43am UTC](https://forum.kirupa.com/t/preloader-problem/273419/1 "2008-10-15T11:43:23Z")

</div>

I only have 1 problem. When I click on a link while the content is loading the preloader text will show more than 100% and the preloader bar will move beyond the end of the load bar.

Here’s the code:

```php

var aImages:Array = new Array("links/link01.swf", "links/link02.swf", "links/link03.swf", "links/link04.swf");
var aButtons:Array = new Array(bLink01, bLink02, bLink03, bLink04);
var myLoader:Loader = new Loader();
var countButtons:int = aButtons.length;

for (var i:int = 0; i<countButtons; i++) {
    aButtons*.addEventListener(MouseEvent.CLICK, loadSWF);
}

myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, movieLoading);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, movieLoaded);
mPreloader.visible = false;

// ######### FUNCTIONS -------------------------------------------------

function setProg(val:Number) {
    mPreloader.mProgress.width = val*mPreloader.mBase.width;
}

function movieLoading(evt:ProgressEvent):void {
    mPreloader.visible = true;
    var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
    var percent:int = loaded * 100;
    mPreloader.tLoaderInfo.text = percent;
    setProg(loaded);
}

function movieLoaded(evt:Event):void {
    addChild(myLoader);
    mPreloader.visible = false;
    for (var i:int = 0; i<countButtons; i++) {

    }
}

function loadSWF(evt:MouseEvent):void {
    var index:int;
    for (var i:int = 0; i<countButtons; i++) {
        if (evt.target.name == aButtons*.name) {
            index = i;
            aButtons*.alpha = .5;
            aButtons*.mouseEnabled= false;
        } else {
            aButtons*.mouseEnabled= true;
            aButtons*.alpha = 1;

        }
    }
    trace( aImages[index] + " Loaded");
    myLoader.load(new URLRequest(aImages[index]));
    addChild(myLoader);
}

```

thanks vxd
