Section 1
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.system.*;
public class Main extends Sprite {
public function Main():void{
Security.allowDomain("*");
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function init(_arg1:Event=null):void{
removeEventListener(Event.ADDED_TO_STAGE, init);
}
}
}//package
Section 2
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class Preloader extends MovieClip {
private var _mLoader:Loader;
public function Preloader(){
addEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
}
private function progress(_arg1:ProgressEvent):void{
}
private function checkFrame(_arg1:Event):void{
if (currentFrame == totalFrames){
removeEventListener(Event.ENTER_FRAME, checkFrame);
startup();
};
}
private function startup():void{
var _local1:String;
var _local2:URLRequest;
stop();
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
addChild((new Main() as DisplayObject));
if (!LoaderInfo(root.loaderInfo).parameters.base_url){
_local1 = "http://viral.s3.amazonaws.com/watchmen/game/main.swf";
} else {
_local1 = LoaderInfo(root.loaderInfo).parameters.base_url;
};
trace("useURL", _local1);
_mLoader = new Loader();
_local2 = new URLRequest(_local1);
_mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
_mLoader.load(_local2);
}
private function onCompleteHandler(_arg1:Event):void{
trace("done");
addChild(_mLoader);
}
}
}//package