home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2011 May / ME_2011_05.iso / Galileo-Video-Tutorial / system / player.swf / scripts / internalApplication.as < prev    next >
Encoding:
Text File  |  2010-11-30  |  16.1 KB  |  586 lines

  1. package
  2. {
  3.    import flash.display.Sprite;
  4.    
  5.    public final class internalApplication
  6.    {
  7.       private var resolver:mdm_Application = null;
  8.       
  9.       public function internalApplication()
  10.       {
  11.          super();
  12.       }
  13.       
  14.       public function set onAppExit(param1:Function) : void
  15.       {
  16.          internal_resolver().onAppExit = param1;
  17.       }
  18.       
  19.       public function set onFormMinimize(param1:Function) : void
  20.       {
  21.          internal_resolver().onFormMinimize = param1;
  22.       }
  23.       
  24.       public function delay(param1:Number, param2:Boolean = true) : void
  25.       {
  26.          internal_resolver().delay(param1);
  27.       }
  28.       
  29.       public function doEvents(param1:Boolean = true) : void
  30.       {
  31.          internal_resolver().doEvents();
  32.       }
  33.       
  34.       public function get Screensaver() : mdm_resolver
  35.       {
  36.          return internal_resolver().Screensaver;
  37.       }
  38.       
  39.       public function set onFormChangeFocus(param1:Function) : void
  40.       {
  41.          internal_resolver().onFormChangeFocus = param1;
  42.       }
  43.       
  44.       public function get isMinimized() : Boolean
  45.       {
  46.          return internal_resolver().isMinimized;
  47.       }
  48.       
  49.       public function exitWithModalResult(param1:String, param2:Boolean = true) : void
  50.       {
  51.          internal_resolver().exitWithModalResult(param1);
  52.       }
  53.       
  54.       public function restore(param1:Boolean = true) : void
  55.       {
  56.          internal_resolver().restore();
  57.       }
  58.       
  59.       public function init(param1:Sprite, param2:Function = null) : void
  60.       {
  61.          internal_resolver().init(param1,param2);
  62.       }
  63.       
  64.       public function exitWithCode(param1:Number, param2:Boolean = true) : void
  65.       {
  66.          internal_resolver().exitWithCode(param1);
  67.       }
  68.       
  69.       public function set onBottomHit(param1:Function) : void
  70.       {
  71.          internal_resolver().onBottomHit = param1;
  72.       }
  73.       
  74.       public function set onDragDrop(param1:Function) : void
  75.       {
  76.          internal_resolver().onDragDrop = param1;
  77.       }
  78.       
  79.       public function bringToFront(param1:Boolean = true) : void
  80.       {
  81.          internal_resolver().bringToFront();
  82.       }
  83.       
  84.       public function shake(param1:Number, param2:Boolean = true) : void
  85.       {
  86.          internal_resolver().shake(param1);
  87.       }
  88.       
  89.       public function minimizeToTray(param1:Boolean, param2:Boolean = true) : void
  90.       {
  91.          internal_resolver().minimizeToTray(param1);
  92.       }
  93.       
  94.       public function set onAppMinimize(param1:Function) : void
  95.       {
  96.          internal_resolver().onAppMinimize = param1;
  97.       }
  98.       
  99.       public function get Library() : mdm_resolver
  100.       {
  101.          return internal_resolver().Library;
  102.       }
  103.       
  104.       public function set onTopHit(param1:Function) : void
  105.       {
  106.          internal_resolver().onTopHit = param1;
  107.       }
  108.       
  109.       public function set onFormRestore(param1:Function) : void
  110.       {
  111.          internal_resolver().onFormRestore = param1;
  112.       }
  113.       
  114.       public function minimize(param1:Boolean = true) : void
  115.       {
  116.          internal_resolver().minimize();
  117.       }
  118.       
  119.       public function get filename() : String
  120.       {
  121.          return internal_resolver().filename;
  122.       }
  123.       
  124.       public function setProxyUsername(param1:String) : void
  125.       {
  126.          internal_resolver().setProxyUsername(param1);
  127.       }
  128.       
  129.       public function exit(param1:String = "", param2:String = "", param3:Boolean = true) : void
  130.       {
  131.          internal_resolver().exit(param1,param2);
  132.       }
  133.       
  134.       public function getCMDParams(param1:Number) : String
  135.       {
  136.          return internal_resolver().getCMDParams(param1);
  137.       }
  138.       
  139.       public function get Timer() : mdm_resolver
  140.       {
  141.          return internal_resolver().Timer;
  142.       }
  143.       
  144.       public function getFormNames() : Array
  145.       {
  146.          return internal_resolver().getFormNames();
  147.       }
  148.       
  149.       public function switchFullScreen(param1:Boolean) : void
  150.       {
  151.          internal_resolver().switchFullScreen(param1);
  152.       }
  153.       
  154.       public function set title(param1:String) : void
  155.       {
  156.          internal_resolver().title = param1;
  157.       }
  158.       
  159.       public function sendToBack(param1:Boolean = true) : void
  160.       {
  161.          internal_resolver().sendToBack();
  162.       }
  163.       
  164.       public function get path() : String
  165.       {
  166.          var _loc1_:String = null;
  167.          var _loc2_:RegExp = null;
  168.          var _loc3_:* = false;
  169.          _loc1_ = internal_resolver().path;
  170.          _loc2_ = /\\\\/g;
  171.          _loc3_ = _loc1_.indexOf("\\\\") == 0;
  172.          return (_loc3_ ? "\\" : "") + _loc1_.replace(_loc2_,"\\");
  173.       }
  174.       
  175.       public function set onFormResize(param1:Function) : void
  176.       {
  177.          internal_resolver().onFormResize = param1;
  178.       }
  179.       
  180.       public function get filenameUnix() : String
  181.       {
  182.          return internal_resolver().filenameUnix;
  183.       }
  184.       
  185.       public function getHttpProxyPort() : String
  186.       {
  187.          return internal_resolver().getHttpProxyPort();
  188.       }
  189.       
  190.       public function printVar(param1:String, param2:Boolean = false, param3:Boolean = true) : void
  191.       {
  192.          internal_resolver().printVar(param1,param2);
  193.       }
  194.       
  195.       public function set onRightHit(param1:Function) : void
  196.       {
  197.          internal_resolver().onRightHit = param1;
  198.       }
  199.       
  200.       private function internal_resolver() : mdm_Application
  201.       {
  202.          if(resolver == null)
  203.          {
  204.             resolver = new mdm_Application();
  205.          }
  206.          return resolver;
  207.       }
  208.       
  209.       public function enableExitHandler(param1:Boolean = true) : void
  210.       {
  211.          internal_resolver().enableExitHandler();
  212.       }
  213.       
  214.       public function maximize(param1:Boolean = true) : void
  215.       {
  216.          internal_resolver().maximize();
  217.       }
  218.       
  219.       public function get pathUnix() : String
  220.       {
  221.          return internal_resolver().pathUnix;
  222.       }
  223.       
  224.       public function getGlobalVar(param1:String) : String
  225.       {
  226.          return internal_resolver().getGlobalVar(param1);
  227.       }
  228.       
  229.       public function get Kiosk() : mdm_resolver
  230.       {
  231.          return internal_resolver().Kiosk;
  232.       }
  233.       
  234.       public function set onAppChangeFocus(param1:Function) : void
  235.       {
  236.          internal_resolver().onAppChangeFocus = param1;
  237.       }
  238.       
  239.       public function showTips(param1:String) : Boolean
  240.       {
  241.          return internal_resolver().showTips(param1);
  242.       }
  243.       
  244.       public function get filenameUnicode() : String
  245.       {
  246.          return internal_resolver().filenameUnicode;
  247.       }
  248.       
  249.       public function set onAppRestore(param1:Function) : void
  250.       {
  251.          internal_resolver().onAppRestore = param1;
  252.       }
  253.       
  254.       public function getHttpsProxyPort() : String
  255.       {
  256.          return internal_resolver().getHttpsProxyPort();
  257.       }
  258.       
  259.       public function getHttpsProxyServer() : String
  260.       {
  261.          return internal_resolver().getHttpsProxyServer();
  262.       }
  263.       
  264.       public function set onFormMaximize(param1:Function) : void
  265.       {
  266.          internal_resolver().onFormMaximize = param1;
  267.       }
  268.       
  269.       public function createForm(param1:String, param2:String, param3:String, param4:Number, param5:Number, param6:Number, param7:Number) : Boolean
  270.       {
  271.          return internal_resolver().createForm(param1,param2,param3,param4,param5,param6,param7);
  272.       }
  273.       
  274.       public function set onLeftHit(param1:Function) : void
  275.       {
  276.          internal_resolver().onLeftHit = param1;
  277.       }
  278.       
  279.       public function set onArrowKeyPress(param1:Function) : void
  280.       {
  281.          internal_resolver().onArrowKeyPress = param1;
  282.       }
  283.       
  284.       public function set onSplashClosed(param1:Function) : void
  285.       {
  286.          internal_resolver().onSplashClosed = param1;
  287.       }
  288.       
  289.       public function setProxyPassword(param1:String) : void
  290.       {
  291.          internal_resolver().setProxyPassword(param1);
  292.       }
  293.       
  294.       public function set onMDMScriptException(param1:Function) : void
  295.       {
  296.          internal_resolver().onMDMScriptException = param1;
  297.       }
  298.       
  299.       public function set onFormClose(param1:Function) : void
  300.       {
  301.          internal_resolver().onFormClose = param1;
  302.       }
  303.       
  304.       public function say(param1:String, param2:Boolean = true) : void
  305.       {
  306.          internal_resolver().say(param1);
  307.       }
  308.       
  309.       public function exitWithDialog(param1:String, param2:Boolean) : void
  310.       {
  311.          internal_resolver().exitWithDialog(param1);
  312.       }
  313.       
  314.       public function getEnvVar(param1:String) : String
  315.       {
  316.          return internal_resolver().getEnvVar(param1);
  317.       }
  318.       
  319.       public function getHttpProxyServer() : String
  320.       {
  321.          return internal_resolver().getHttpProxyServer();
  322.       }
  323.       
  324.       public function textAreaEnhance(param1:Boolean, param2:Boolean = true) : void
  325.       {
  326.          internal_resolver().textAreaEnhance(param1);
  327.       }
  328.       
  329.       public function get Trial() : mdm_resolver
  330.       {
  331.          return internal_resolver().Trial;
  332.       }
  333.       
  334.       public function get pathUnicode() : String
  335.       {
  336.          var _loc1_:String = null;
  337.          var _loc2_:RegExp = null;
  338.          var _loc3_:* = false;
  339.          _loc1_ = internal_resolver().path;
  340.          _loc2_ = /\\\\/g;
  341.          _loc3_ = _loc1_.indexOf("\\\\") == 0;
  342.          return (_loc3_ ? "\\" : "") + _loc1_.replace(_loc2_,"\\");
  343.       }
  344.       
  345.       public function getSecureVar(param1:String) : String
  346.       {
  347.          return internal_resolver().getSecureVar(param1);
  348.       }
  349.       
  350.       public function setEnvVar(param1:String, param2:String, param3:Boolean = true) : void
  351.       {
  352.          internal_resolver().setEnvVar(param1,param2);
  353.       }
  354.       
  355.       public function set onFormReposition(param1:Function) : void
  356.       {
  357.          internal_resolver().onFormReposition = param1;
  358.       }
  359.    }
  360. }
  361.  
  362. import flash.display.Sprite;
  363. import flash.events.Event;
  364. import flash.utils.ByteArray;
  365. import mdm.Alert2;
  366.  
  367. dynamic class mdm_Application extends mdm_resolver
  368. {
  369.    private var m_onInitCallback:Function = null;
  370.    
  371.    private var m_bInitDispatched:Boolean = false;
  372.    
  373.    public function mdm_Application()
  374.    {
  375.       super();
  376.       SetClassName("mdm.Application");
  377.       AddEvents();
  378.       AddObject("Library",null);
  379.       AddObject("Screensaver",null);
  380.       AddObject("Timer",new mdm_Timer());
  381.       AddObject("Trial",null);
  382.       AddObject("Kiosk",null);
  383.    }
  384.    
  385.    public function init(param1:Sprite, param2:Function = null) : void
  386.    {
  387.       var strURL:String = null;
  388.       var dispObj:Sprite = param1;
  389.       var onInitCallback:Function = param2;
  390.       strURL = null;
  391.       try
  392.       {
  393.          strURL = dispObj.root.loaderInfo.url;
  394.       }
  395.       catch(e:Error)
  396.       {
  397.       }
  398.       finally
  399.       {
  400.          if(strURL == null)
  401.          {
  402.             try
  403.             {
  404.                var _loc6_:* = ¬ß¬ßpop();
  405.                strURL = (dispObj as Object).url;
  406.             }
  407.             catch(e:Error)
  408.             {
  409.             }
  410.             ¬ß¬ßpush(_loc6_);
  411.          }
  412.       }
  413.       AssocURL(strURL);
  414.       mdmSetup();
  415.       m_spr = dispObj;
  416.       Alert2.init(dispObj.stage);
  417.       if(onInitCallback != null)
  418.       {
  419.          m_onInitCallback = onInitCallback;
  420.          dispObj.addEventListener("enterFrame",onInitialise);
  421.       }
  422.    }
  423.    
  424.    private function onInitialise(param1:Event) : void
  425.    {
  426.       if(!m_bInitDispatched && m_onInitCallback != null)
  427.       {
  428.          m_bInitDispatched = true;
  429.          m_onInitCallback();
  430.       }
  431.    }
  432.    
  433.    private function AddEvents() : void
  434.    {
  435.       AddEvent("onAppChangeFocus",true);
  436.       AddEvent("onAppExit",false);
  437.       AddEvent("onAppMinimize",false);
  438.       AddEvent("onAppRestore",false);
  439.       AddEvent("onArrowKeyPress",true);
  440.       AddEvent("onBottomHit",false);
  441.       AddEvent("onDragDrop",true);
  442.       AddEvent("onFormChangeFocus",true);
  443.       AddEvent("onFormClose",false);
  444.       AddEvent("onFormMaximize",true);
  445.       AddEvent("onFormMinimize",true);
  446.       AddEvent("onFormReposition",true);
  447.       AddEvent("onFormResize",true);
  448.       AddEvent("onFormRestore",true);
  449.       AddEvent("onLeftHit",false);
  450.       AddEvent("onMDMScriptException",true);
  451.       AddEvent("onRightHit",false);
  452.       AddEvent("onSplashClosed",false);
  453.       AddEvent("onTopHit",false);
  454.    }
  455. }
  456.  
  457. dynamic class mdm_Timer extends mdm_resolver
  458. {
  459.    public function mdm_Timer()
  460.    {
  461.       super();
  462.       SetClassName("mdm.Application.Timer");
  463.       AddEvents();
  464.    }
  465.    
  466.    private function AddEvents() : void
  467.    {
  468.       AddEvent("onTimer0",false);
  469.       AddEvent("onTimer1",false);
  470.       AddEvent("onTimer2",false);
  471.       AddEvent("onTimer3",false);
  472.       AddEvent("onTimer4",false);
  473.       AddEvent("onTimer5",false);
  474.       AddEvent("onTimer6",false);
  475.       AddEvent("onTimer7",false);
  476.       AddEvent("onTimer8",false);
  477.       AddEvent("onTimer9",false);
  478.       AddEvent("onTimer10",false);
  479.    }
  480. }
  481.  
  482. class Base64
  483. {
  484.    private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  485.    
  486.    public function Base64()
  487.    {
  488.       super();
  489.       throw new Error("Base64 class is static container only");
  490.    }
  491.    
  492.    public static function encode(param1:String) : String
  493.    {
  494.       var _loc2_:ByteArray = null;
  495.       _loc2_ = new ByteArray();
  496.       _loc2_.writeUTFBytes(param1);
  497.       return encodeByteArray(_loc2_);
  498.    }
  499.    
  500.    public static function decodeToByteArray(param1:String) : ByteArray
  501.    {
  502.       var _loc2_:ByteArray = null;
  503.       var _loc3_:Array = null;
  504.       var _loc4_:Array = null;
  505.       var _loc5_:uint = 0;
  506.       var _loc6_:uint = 0;
  507.       var _loc7_:uint = 0;
  508.       _loc2_ = new ByteArray();
  509.       _loc3_ = new Array(4);
  510.       _loc4_ = new Array(3);
  511.       _loc5_ = 0;
  512.       while(_loc5_ < param1.length)
  513.       {
  514.          _loc6_ = 0;
  515.          while(_loc6_ < 4 && _loc5_ + _loc6_ < param1.length)
  516.          {
  517.             _loc3_[_loc6_] = BASE64_CHARS.indexOf(param1.charAt(_loc5_ + _loc6_));
  518.             _loc6_++;
  519.          }
  520.          _loc4_[0] = (_loc3_[0] << 2) + ((_loc3_[1] & 0x30) >> 4);
  521.          _loc4_[1] = ((_loc3_[1] & 0x0F) << 4) + ((_loc3_[2] & 0x3C) >> 2);
  522.          _loc4_[2] = ((_loc3_[2] & 3) << 6) + _loc3_[3];
  523.          _loc7_ = 0;
  524.          while(_loc7_ < _loc4_.length)
  525.          {
  526.             if(_loc3_[_loc7_ + 1] == 64)
  527.             {
  528.                break;
  529.             }
  530.             _loc2_.writeByte(_loc4_[_loc7_]);
  531.             _loc7_++;
  532.          }
  533.          _loc5_ += 4;
  534.       }
  535.       _loc2_.position = 0;
  536.       return _loc2_;
  537.    }
  538.    
  539.    public static function encodeByteArray(param1:ByteArray) : String
  540.    {
  541.       var _loc2_:String = null;
  542.       var _loc3_:Array = null;
  543.       var _loc4_:Array = null;
  544.       var _loc5_:uint = 0;
  545.       var _loc6_:uint = 0;
  546.       var _loc7_:uint = 0;
  547.       _loc2_ = "";
  548.       _loc4_ = new Array(4);
  549.       param1.position = 0;
  550.       while(param1.bytesAvailable > 0)
  551.       {
  552.          _loc3_ = new Array();
  553.          _loc5_ = 0;
  554.          while(_loc5_ < 3 && param1.bytesAvailable > 0)
  555.          {
  556.             _loc3_[_loc5_] = param1.readUnsignedByte();
  557.             _loc5_++;
  558.          }
  559.          _loc4_[0] = (_loc3_[0] & 0xFC) >> 2;
  560.          _loc4_[1] = (_loc3_[0] & 3) << 4 | _loc3_[1] >> 4;
  561.          _loc4_[2] = (_loc3_[1] & 0x0F) << 2 | _loc3_[2] >> 6;
  562.          _loc4_[3] = _loc3_[2] & 0x3F;
  563.          _loc6_ = _loc3_.length;
  564.          while(_loc6_ < 3)
  565.          {
  566.             _loc4_[_loc6_ + 1] = 64;
  567.             _loc6_++;
  568.          }
  569.          _loc7_ = 0;
  570.          while(_loc7_ < _loc4_.length)
  571.          {
  572.             _loc2_ += BASE64_CHARS.charAt(_loc4_[_loc7_]);
  573.             _loc7_++;
  574.          }
  575.       }
  576.       return _loc2_;
  577.    }
  578.    
  579.    public static function decode(param1:String) : String
  580.    {
  581.       var _loc2_:ByteArray = null;
  582.       _loc2_ = decodeToByteArray(param1);
  583.       return _loc2_.readUTFBytes(_loc2_.length);
  584.    }
  585. }
  586.