Copy link to clipboard
Copied
I write this script for loader and it gives an error
Idon't know where is the mistake.
so please help me to sort out the error.
Thanks in Advanced
This is the Script
stop();
addEventListener(Event.ENTER_FRAME, preLoad);
function preLoad(event:Event):void{
var bytestoLoad:Number = loaderInfo.bytesTotal;
var numberLoaded:Number = loaderInfo.bytesLoaded;
if(bytestoLoad == numberLoaded){
removeEventListener(Event.ENTER_FRAME, preLoad);
gotoAndPlay(2);
}else{
preLoader.preLoaderFill.scaleX = numberLoaded/bytestoLoad;
}
}
Copy link to clipboard
Copied
Just change your gotoAndPlay(2) to play();
Try with:
stop();
this.addEventListener(Event.ENTER_FRAME, loading);
function loading(e:Event):void{
var total:Number = this.stage.loaderInfo.bytesTotal;
var loaded:Number = this.stage.loaderInfo.bytesLoaded;
if (total == loaded){
play();
ploader.visible=false;
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}
Copy link to clipboard
Copied
It does'nt work for me. My loader also not work after applying the script
Copy link to clipboard
Copied
It will work, might be some other problem. can you send the file relaxatraja@aol.com to have a look.
Copy link to clipboard
Copied
Hi guys,
Even I'm having the same problem..The coding compiles fine but the moment I change the broadband speed to check the preloader I get an error saying "Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed."...
This is my Coding..
import flash.events.Event;
stop();
addEventListener(Event.ENTER_FRAME, LoaderF);
function LoaderF(e:Event):void {
var toLoad:Number = loaderInfo.bytesTotal;
var Loaded:Number = loaderInfo.bytesLoaded;
var total:Number = Loaded/toLoad;
if (Loaded == toLoad){
removeEventListener(Event.ENTER_FRAME, LoaderF);
gotoAndStop(2);
} else {
Preloader_Mc.McPreloaderFill.scaleX = total;
Preloader_Mc.Percent_txt.text = Math.floor(total*100)+"%";
}
}
And the Percentage_txt(it is a Dynamic text where the percentage completed shows) dosen't work as well..
Any Solution ???
- Nishan