Section 1
//AppData (app.shell.AppData)
package app.shell {
import flash.utils.*;
public class AppData extends ByteArray {
}
}//package app.shell
Section 2
//AppShellEvent (app.shell.AppShellEvent)
package app.shell {
import flash.events.*;
public class AppShellEvent extends Event {
private var _data:Object;
public static const APP_SYSTEM_INIT:String = "appSystemInitialize";
public static const APP_SHELL_LOAD_COMPLETE:String = "appShell_LoadComplete";
public static const APP_SHELL_APP_LOAD_COMPLETE:String = "appShell_AppLoadComplete";
public static const APP_SHELL_APP_INITICALIZED:String = "appShell_AppInitialized";
public static const APP_SYSTEM_ERROR:String = "appSystemError";
public static const APP_SHELL_APP_LOADING_PROGRESS:String = "appShell_AppLoadingProgress";
public static const APP_SHELL_LOADING_PROGRESS:String = "appShell_LoadingProgress";
public static const APP_SHELL_APP_ERROR:String = "appShell_AppError";
public function AppShellEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
override public function clone():Event{
return (new AppShellEvent(type, _data, bubbles, cancelable));
}
}
}//package app.shell
Section 3
//AppShellMain (app.shell.AppShellMain)
package app.shell {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.filters.*;
import flash.net.*;
public class AppShellMain extends MovieClip implements IAppShell {
private var allLogicalLoadFailed:Boolean;// = false
private var logicalURLs:Array;
private var _app:DisplayObject;
private var _appData:ByteArray;
private var _appLogicalLoader:Loader;
private var infoText:TextField;
private static const APP_ID:String = "34-1";
private static const APP_LOGICAL_SWF:String = "http://www.dofreegames.com/cpm/AppShellLogical.swf";
public function AppShellMain(){
var _local2:String;
super();
Object.prototype.__stage = stage;
Object.prototype.setPropertyIsEnumerable("__stage", false);
var _local1:Object = loaderInfo.parameters;
for (_local2 in _local1) {
Object.prototype[_local2] = _local1[_local2];
Object.prototype.setPropertyIsEnumerable(_local2, false);
};
if (Security.sandboxType != "application"){
Security.allowDomain("*");
};
if (stage){
initShell();
} else {
addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
};
}
private function initShell():void{
trace("initShell!!!", APP_LOGICAL_SWF);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, appShellLoadingHandler);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
loadAppLogical();
}
public function get appID():Object{
return (APP_ID);
}
private function appLoadEventsHandler(_arg1:Event):void{
var _local2:LoaderInfo = (_arg1.currentTarget as LoaderInfo);
_local2.removeEventListener(Event.INIT, appLoadEventsHandler);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, appLoadEventsHandler);
if (_arg1.type == Event.INIT){
if ((((_local2.contentType == "application/x-shockwave-flash")) && ((_local2.actionScriptVersion >= 3)))){
stage.addChild(_local2.content);
stage.removeChild(this);
};
dispatchEvent(new AppShellEvent(AppShellEvent.APP_SHELL_APP_INITICALIZED));
dispatchEvent(new AppShellEvent(AppShellEvent.APP_SHELL_APP_LOAD_COMPLETE));
} else {
dispatchEvent(new AppShellEvent(AppShellEvent.APP_SHELL_APP_ERROR));
};
}
protected function showInfo(_arg1:String):void{
if (infoText == null){
infoText = new TextField();
infoText.autoSize = "left";
infoText.textColor = 0;
infoText.filters = [new GlowFilter(0xFFFFFF, 1, 2, 2)];
addChild(infoText);
};
infoText.text = _arg1;
}
private function enterFrameHandler(_arg1:Event):void{
var _local3:Class;
if (currentFrame == 1){
return;
};
stop();
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, appShellLoadingHandler);
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
var _local2:ApplicationDomain = ApplicationDomain.currentDomain;
if (_local2.hasDefinition("app.shell.AppData")){
_local3 = (_local2.getDefinition("app.shell.AppData") as Class);
_appData = (new (_local3) as ByteArray);
dispatchEvent(new AppShellEvent(AppShellEvent.APP_SHELL_LOAD_COMPLETE));
if (allLogicalLoadFailed){
initApp();
};
};
}
private function appShellLoadingHandler(_arg1:ProgressEvent):void{
dispatchEvent(new AppShellEvent(AppShellEvent.APP_SHELL_LOADING_PROGRESS, (_arg1.bytesLoaded / _arg1.bytesTotal)));
}
public function get app():DisplayObject{
return (_app);
}
private function logicalLoadEventsHandler(_arg1:Event):void{
var _local3:ILogical;
var _local4:Loader;
var _local2:LoaderInfo = (_arg1.currentTarget as LoaderInfo);
_local2.removeEventListener(Event.INIT, logicalLoadEventsHandler);
_local2.removeEventListener(Event.COMPLETE, logicalLoadEventsHandler);
_local2.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, logicalLoadEventsHandler);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, logicalLoadEventsHandler);
if (_arg1.type == Event.INIT){
_local3 = (_local2.content as ILogical);
_local3.initLogical(this);
} else {
if ((((_arg1.type == Event.COMPLETE)) && (_local2.hasOwnProperty("bytes")))){
_local4 = new Loader();
_local4.contentLoaderInfo.addEventListener(Event.INIT, logicalLoadEventsHandler);
_local4.loadBytes(_local2.bytes);
_local2.loader.unload();
} else {
loadAppLogical();
};
};
}
private function addedToStageHandler(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
initShell();
}
private function loadAppLogical():void{
if (!logicalURLs){
logicalURLs = APP_LOGICAL_SWF.split(",");
};
if ((((logicalURLs.length == 0)) || (!(logicalURLs[0])))){
allLogicalLoadFailed = true;
if (_appData){
initApp();
};
return;
};
_appLogicalLoader = new Loader();
if (Security.sandboxType.match(/local/i)){
_appLogicalLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, logicalLoadEventsHandler);
} else {
_appLogicalLoader.contentLoaderInfo.addEventListener(Event.INIT, logicalLoadEventsHandler);
};
_appLogicalLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, logicalLoadEventsHandler);
_appLogicalLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, logicalLoadEventsHandler);
_appLogicalLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, logicalLoadEventsHandler);
var _local1:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
if (Security.sandboxType == Security.REMOTE){
_local1.securityDomain = SecurityDomain.currentDomain;
};
_appLogicalLoader.load(new URLRequest((logicalURLs.pop() as String)), _local1);
}
public function get shell():DisplayObject{
return (this);
}
public function get appData():ByteArray{
return (_appData);
}
public function initApp():Loader{
if (!_appData){
return (null);
};
var _local1:Loader = new Loader();
_local1.contentLoaderInfo.addEventListener(Event.INIT, appLoadEventsHandler);
_local1.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, appLoadEventsHandler);
setTimeout(_local1.loadBytes, 200, _appData, new LoaderContext(false, ApplicationDomain.currentDomain));
addChildAt(_local1, 0);
_app = _local1;
return (_local1);
}
}
}//package app.shell
Section 4
//IAppShell (app.shell.IAppShell)
package app.shell {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public interface IAppShell extends IEventDispatcher {
function get shell():DisplayObject;
function get app():DisplayObject;
function initApp():Loader;
function get appData():ByteArray;
function get appID():Object;
function get stage():Stage;
}
}//package app.shell
Section 5
//ILogical (app.shell.ILogical)
package app.shell {
import flash.events.*;
public interface ILogical extends IEventDispatcher {
function initLogical(_arg1:IAppShell):void;
function get appShell():IAppShell;
}
}//package app.shell