package{
import flash.display.MovieClip;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flashx.textLayout.formats.TextAlign;
import flash.text.TextField;
public class loadingClass extends MovieClip{
public function loadingClass(){
shanchu_button.addEventListener(MouseEvent.CLICK,d_shanchu);
load_button.addEventListener(MouseEvent.CLICK,d_load);
loading();
}
public function d_shanchu(evt:Event):void{
this.removeChild(this.getChildByName("Main"));
}
public function d_load(evt:Event):void{
loading();
}
public function loading(){
var request:URLRequest = new URLRequest("daiyanren.swf");
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
loadProgress);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
loadComplete);
loader.load(request);
loader.name = 'Main';
this.addChildAt(loader,0);
}
function loadProgress(event:ProgressEvent):void{
var percentLoaded:Number = event.bytesLoaded / event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
loadText.text = "Loading: "+percentLoaded+"%";
trace("Loading: "+percentLoaded+"%");
}
function loadComplete(event:Event):void{
trace("Complete");
}
}
}
08-10
575
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)