I'm working on a game in Flash CS5 / AS3 and I'm trying to get my preloader to work. At the moment, when I load the SWF file with 'simulate download', the file will load but my preloader won't show. The preloader does show for a moment when the loading is at around 90%.
I have unchecked 'export to first frame' since that's what the Internet told me to do, but there are so many different tutorials for nearly every version of Flash/AS around that I'm rather confused; not sure how to fix this.
My preloader code is as follows:
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;
percent_txt.text = Math.floor((loaded/total)*100)+ "%";
if (total == loaded){
play();
this.removeEventListener(Event.ENTER_FRAME, loading);
}
}
Not sure if this is of any help though. Hopefully someone knows a quick fix. I read somewhere that this might have to do with sound files (I do have a couple of these) but yeah, not quite sure where to start.
Thanks in advance!