-
Notifications
You must be signed in to change notification settings - Fork 1
/
Holder.as
51 lines (43 loc) · 1.45 KB
/
Holder.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package {
import flash.display.Sprite;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
public class Holder extends Sprite {
private var loadProgress:TextField;
private var loader:Loader;
public function Holder() {
init();
}
public function init():void {
loader = new Loader()
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
loader.load(new URLRequest("NewsReader.swf"));
addChild(loader);
loadProgress = new TextField();
addChild(loadProgress);
loadProgress.width = 80;
loadProgress.height = 20;
loadProgress.x = stage.stageWidth / 2 - 40;
loadProgress.y = stage.stageHeight / 2 - 10;
var format:TextFormat = new TextFormat();
format.font = "Courier New";
format.size = 12;
format.align = TextFormatAlign.CENTER;
loadProgress.defaultTextFormat = format;
}
private function onComplete(event:Event):void {
loadProgress.visible = false;
}
private function onProgress(event:ProgressEvent):void {
var loaded:Number = event.target.bytesLoaded;
var total:Number = event.target.bytesTotal;
loadProgress.text = loaded + " / " + total;
}
}
}