l'approccio in finale è abbastanza semplice, ho optato per un "preload grafico" semplice con una casella di testo che mi dice la percentuale caricata, con un testo a 100pt
il codice della Document class del preload è questo:
Codice PHP:
package {
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class StagePreload extends Sprite {
private var __u:String;
private var __r:URLRequest;
private var __l:Loader;
private var __t:TextField;
private var __f:TextFormat;
public function StagePreload () {
__u = "filmato_principale.swf";
__r = new URLRequest(__u);
__l = new Loader();
__t = new TextField();
__f = new TextFormat("Arial Black", 100, 0xFFFFFF);
__f.align = TextFormatAlign.CENTER;
__init__();
}
private function __init__() {
__l.contentLoaderInfo.addEventListener(Event.INIT, __loadinit__);
__l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, __progress__);
__l.load(__r);
__t.defaultTextFormat = __f;
__t.selectable = false;
__t.width = 400;
__t.height = 100;
__t.x = (stage.stageWidth-400)/2;
__t.y = (stage.stageHeight-100)/2;
addChild(__t);
}
private function __loadinit__ (e:Event) {
stage.addChildAt(__l.content, stage.numChildren-1);
stage.removeChild(this);
}
private function __progress__ (e:ProgressEvent) {
__t.text = (Math.floor((e.bytesLoaded/e.bytesTotal)*100))+"%";
}
}
}