home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 150 / MOBICLIC150.ISO / pc / DATA / HOTE / launcher_as3 / launcher.swf / scripts / com / milanpresse / launcher / HoteAS2.as < prev    next >
Text File  |  2012-12-18  |  5KB  |  161 lines

  1. package com.milanpresse.launcher
  2. {
  3.    import flash.display.DisplayObjectContainer;
  4.    import flash.display.Loader;
  5.    import flash.errors.IOError;
  6.    import flash.events.Event;
  7.    import flash.events.IOErrorEvent;
  8.    import flash.net.URLRequest;
  9.    import mx.utils.UIDUtil;
  10.    
  11.    public class HoteAS2
  12.    {
  13.        
  14.       
  15.       private var _callback:Function = null;
  16.       
  17.       private var _callback_load:Function = null;
  18.       
  19.       private var _callback_start:Function = null;
  20.       
  21.       private var _callback_getConfig:Function = null;
  22.       
  23.       private var _loader:Loader;
  24.       
  25.       private var _localConnection:HoteAS2LocalConnection;
  26.       
  27.       private var _mainMC;
  28.       
  29.       private var _moduleController:CapsuleAlgo;
  30.       
  31.       public function HoteAS2(param1:CapsuleAlgo, param2:Function)
  32.       {
  33.          super();
  34.          this._moduleController = param1;
  35.          this._callback = param2;
  36.          this.init();
  37.       }
  38.       
  39.       private function init() : void
  40.       {
  41.          this._loader = new Loader();
  42.          this._loader.contentLoaderInfo.addEventListener(Event.INIT,this.loaderInitHandler);
  43.          this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE,this.loaderCompleteHandler);
  44.          this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,this.ioErrorHandler);
  45.          var _loc1_:String = UIDUtil.createUID();
  46.          this._localConnection = new HoteAS2LocalConnection(this);
  47.          this._localConnection.connect(_loc1_);
  48.          this._loader.load(new URLRequest("DATA/HOTE/host_as2/bin/host_as2.swf?lc=" + _loc1_));
  49.       }
  50.       
  51.       private function ioErrorHandler(param1:IOErrorEvent) : void
  52.       {
  53.          this._loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,this.ioErrorHandler);
  54.          throw new IOError(param1.text);
  55.       }
  56.       
  57.       private function loaderInitHandler(param1:Event) : void
  58.       {
  59.          this._loader.contentLoaderInfo.removeEventListener(Event.INIT,this.loaderInitHandler);
  60.       }
  61.       
  62.       private function loaderCompleteHandler(param1:Event) : void
  63.       {
  64.          this._loader.contentLoaderInfo.removeEventListener(Event.INIT,this.loaderInitHandler);
  65.          this._loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR,this.ioErrorHandler);
  66.          this._loader.contentLoaderInfo.removeEventListener(Event.COMPLETE,this.loaderCompleteHandler);
  67.          this._mainMC = this._loader;
  68.       }
  69.       
  70.       public function hostIsInitialized() : void
  71.       {
  72.          this._callback();
  73.       }
  74.       
  75.       public function changeModule(param1:Object = null) : void
  76.       {
  77.          this._moduleController.changeModule(param1);
  78.       }
  79.       
  80.       public function print(param1:Object = null) : void
  81.       {
  82.          this._moduleController.print(param1);
  83.       }
  84.       
  85.       public function moduleIsInit(param1:Object = null) : void
  86.       {
  87.          this._moduleController.moduleIsInit();
  88.       }
  89.       
  90.       public function moduleStart(param1:Function) : void
  91.       {
  92.          this._localConnection.send("moduleStart");
  93.       }
  94.       
  95.       public function moduleIsStart(param1:Object = null) : void
  96.       {
  97.          this._moduleController.moduleIsStart();
  98.       }
  99.       
  100.       public function moduleAnimIsInit(param1:Object = null) : void
  101.       {
  102.          this._moduleController.moduleAnimIsInit();
  103.       }
  104.       
  105.       public function getModuleConfig(param1:Function) : void
  106.       {
  107.          this._callback_getConfig = param1;
  108.          this._localConnection.send("getModuleConfig");
  109.       }
  110.       
  111.       public function getModuleConfigReturn(param1:Object = null) : void
  112.       {
  113.          this._callback_getConfig(param1);
  114.       }
  115.       
  116.       public function addToParent(param1:DisplayObjectContainer) : void
  117.       {
  118.          param1.addChild(this._mainMC);
  119.       }
  120.       
  121.       public function removeFromParent() : void
  122.       {
  123.          if(this._mainMC.parent != null)
  124.          {
  125.             this._mainMC.parent.removeChild(this._mainMC);
  126.          }
  127.       }
  128.       
  129.       public function loadModule(param1:Object, param2:Function) : void
  130.       {
  131.          this._callback_load = param2;
  132.          this._localConnection.send("setModule",null,param1);
  133.       }
  134.       
  135.       public function set musicOn(param1:Boolean) : void
  136.       {
  137.          this._localConnection.send("musicOn",null,param1);
  138.       }
  139.       
  140.       public function set subtitlesOn(param1:Boolean) : void
  141.       {
  142.          this._localConnection.send("subtitlesOn",null,param1);
  143.       }
  144.       
  145.       public function closeModule() : void
  146.       {
  147.          this._localConnection.send("closeModule",null);
  148.       }
  149.       
  150.       public function sleepModule() : void
  151.       {
  152.          this._localConnection.send("sleepModule",null);
  153.       }
  154.       
  155.       public function wakeModule() : void
  156.       {
  157.          this._localConnection.send("wakeModule",null);
  158.       }
  159.    }
  160. }
  161.