听起来很简单吧?显然不是,因为以前对我有用过无数次的东西现在都行不通了,我也不知道为什么,我什么都试过了。这是用于 as3 的预加载器。
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;
preloader.bar_mc.gotoAndPlay(Math.floor((loaded/total)*100));
if (total == loaded) {
this.removeEventListener(Event.ENTER_FRAME, loading);
preloader.playLoad.gotoAndPlay(2);
}
}
preloader.playLoad.playButton.addEventListener(MouseEvent.CLICK, playClick);
function playClick(ev:MouseEvent):void {
gotoAndPlay(2);
}