Well, since it is all supposed to be one SWF file, I’m doing all the preloading in Frame1.
I have a simple textField on the stage which displays the percentage, and this code every frame:
stop();
import flash.events.ProgressEvent;
// Check if already loaded
if (this.loaderInfo.bytesLoaded == this.loaderInfo.bytesTotal )
{ this.nextFrame(); }
else
{
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, update);
function update(e:ProgressEvent):void
{
if (e.bytesLoaded == e.bytesTotal)
{
this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, update);
this.nextFrame();
}
else
{
percentText.text = Math.floor( (e.bytesLoaded*100)/e.bytesTotal ) + "%";
}
}
}
Sadly, the textField will not show up until the SWF is loaded to about 70%.
Is there any reason why, and any workaround?