Section 1
//MainTimeline (loader_fla.MainTimeline)
package loader_fla {
import flash.events.*;
import flash.display.*;
public dynamic class MainTimeline extends MovieClip {
public var loadswf:CTLoading;
public var stageH:Number;
public var stageW:Number;
public var minH:int;
public var minW:int;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function enterframeHandler(_arg1:Event):void{
if (loadswf._success == "ok"){
MovieClip(loadswf.content).play();
stage.removeEventListener(Event.ENTER_FRAME, enterframeHandler);
};
}
function frame1(){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, resizeHandler);
stage.quality = StageQuality.HIGH;
stageW = stage.stageWidth;
stageH = stage.stageHeight;
minW = 0x0400;
minH = 614;
loadswf = new CTLoading("count.swf");
addChild(loadswf);
stage.dispatchEvent(new Event(Event.RESIZE));
stage.addEventListener(Event.ENTER_FRAME, enterframeHandler);
}
public function resizeHandler(_arg1:Event):void{
if (stage.stageWidth < minW){
stageW = minW;
} else {
stageW = stage.stageWidth;
};
if (stage.stageHeight < minH){
stageH = minH;
} else {
stageH = stage.stageHeight;
};
loadswf.x = ((stageW - minW) / 2);
loadswf.y = ((stageH - minH) / 2);
}
}
}//package loader_fla
Section 2
//CTLoading (CTLoading)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class CTLoading extends Loader {
private var ct_success:String;
private var ct_per:Number;
private var ct_url:URLRequest;
private var ct_info:LoaderInfo;
public function CTLoading(_arg1:String):void{
trace(("読み込みファイル:" + _arg1));
ct_success = null;
ct_per = 0;
ct_info = this.contentLoaderInfo;
ct_url = new URLRequest(_arg1);
ct_info.addEventListener(Event.OPEN, LoaderInfoOpenFunc);
ct_info.addEventListener(ProgressEvent.PROGRESS, LoaderInfoProgressFunc);
ct_info.addEventListener(Event.INIT, LoaderInfoInitFunc);
ct_info.addEventListener(Event.COMPLETE, LoaderInfoCompleteFunc);
ct_info.addEventListener(IOErrorEvent.IO_ERROR, LoaderInfoIOErrorFunc);
this.load(ct_url);
}
public function get _percent():Number{
return (ct_per);
}
public function LoaderInfoIOErrorFunc(_arg1:IOErrorEvent):void{
trace("ファイル入出力のエラー");
ct_success = "error";
}
public function LoaderInfoInitFunc(_arg1:Event):void{
trace("読み込んだコンテンツの初期化が行われプロパティにアクセス可能");
}
public function LoaderInfoCompleteFunc(_arg1:Event):void{
trace("読み込みを完了");
ct_success = "ok";
ct_per = 1;
}
public function LoaderInfoProgressFunc(_arg1:ProgressEvent):void{
trace(("読込:" + _arg1.bytesLoaded));
trace(("全体:" + _arg1.bytesTotal));
trace(("パーセント:" + Math.floor(((_arg1.bytesLoaded / _arg1.bytesTotal) * 100))));
ct_per = (_arg1.bytesLoaded / _arg1.bytesTotal);
}
public function ct_Unload():void{
this.unload();
}
public function LoaderInfoOpenFunc(_arg1:Event):void{
trace("読み込みを開始");
}
public function get _success():String{
return (ct_success);
}
}
}//package