# My preloader works locally, but not on a server

**URL:** <https://forum.kirupa.com/t/my-preloader-works-locally-but-not-on-a-server/283544>\
**Category:** flash\
**Created:** [March 7, 2009, 8:57pm UTC](https://forum.kirupa.com/t/my-preloader-works-locally-but-not-on-a-server/283544 "2009-03-07T20:57:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MFoller](https://avatars.discourse-cdn.com/v4/letter/m/839c29/32.png) [@MFoller](https://forum.kirupa.com/u/MFoller)\
**Post date:** [March 7, 2009, 8:57pm UTC](https://forum.kirupa.com/t/my-preloader-works-locally-but-not-on-a-server/283544/1 "2009-03-07T20:57:18Z")

</div>

Hi everyone, I’m new here and here goes with my first post:

I’m working on a website ([www.fworks.dk](http://www.fworks.dk) - don’t think the flash file can be seen in FF yet) and I want to load an swf-file with some illustrations and such. As this could get a little big, I have made another swf-file which shows a preloader and loads the first swf-file. The preloader works perfectly when tested in Flash CS3, but when uploaded to and tried on my webhost’s server, the preloader doesn’t load anything. Instead it of the load-percentage it just writes “NaN”.

You can finde the as3-code down below. The preloader-swf and the swf to be loaded are located in the same folder. Both are as3.

I really hope one of you guros can help me. Thanks a lot in advance.

This is the code from my as-class file:

package classes{

// Imports necessary classes  
import flash.display.MovieClip;  
import flash.text.TextField;  
import flash.events.Event;  
import flash.events.ProgressEvent;  
import [flash.net](http://flash.net).\*;  
import flash.display.Loader;  
import flash.display.DisplayObject;

public class LoadBar extends MovieClip {  
public function LoadBar() {  
// Code starts here

// Defines the initial states of the bar and border  
loadBar\_mc.scaleX = 0;  
loadBorder\_mc.visible = false;

// Creates a loader and defines what to load  
var loader = new Loader();  
loader.load(new URLRequest(“done.swf”));  
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);  
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);  
addChild(loader);

// Defines what happens when the file has been loaded  
function onCompleteHandler(e:Event):void {  
loadBar\_mc.visible = false;  
loadBorder\_mc.visible = false;  
loadText\_txt.visible = false;  
}

// Defines what happens while the file is being loaded  
function progressHandler(e:ProgressEvent):void {  
var percent = (e.bytesLoaded / e.bytesTotal);  
loader.visible = true;  
loadBar\_mc.scaleX = percent;  
loadBorder\_mc.visible = true;  
loadBar\_mc.visible = true;  
loadText\_txt.visible = true;  
loadText\_txt.text = "Loading environment " + (Math.round(percent \* 100)) + “%”;  
}

// Code ends here  
}  
}  
}
