flash as3.0预加载

代码:

stop();
import flash.events.*;
this.root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, load_progress);
function load_progress(evt:ProgressEvent){
trace("loaded:"+int(evt.bytesLoaded*100/evt.bytesTotal)+"%");
loading_txt.text=int(evt.bytesLoaded*100/evt.bytesTotal).toString()+"%";
}

this.root.loaderInfo.addEventListener(Event.COMPLETE, load_complete);
function load_complete(evt:Event){
loading_txt.text="100%";
this.root.loaderInfo.removeEventListener(Event.COMPLETE,load_complete);
gotoAndStop(2);
}

你可能感兴趣的:(Flash)