home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2011 May / ME_2011_05.iso / Galileo-Video-Tutorial / main.swf / scripts / __Packages / pro / videotrainingIII / Application.as
Encoding:
Text File  |  2010-08-12  |  11.4 KB  |  390 lines

  1. class pro.videotrainingIII.Application
  2. {
  3.    var timeline;
  4.    var mainData;
  5.    var dictionary;
  6.    var loadingController;
  7.    var contentController;
  8.    var introController;
  9.    static var instance;
  10.    static var thread;
  11.    static var VERSION = "3.120";
  12.    static var WIDTH = 1024;
  13.    static var HEIGHT = 712;
  14.    static var DEPTH_MESSAGE = 310;
  15.    static var DEPTH_BORDER = 300;
  16.    static var DEPTH_INTRO = 299;
  17.    static var DEPTH_LOADER = 200;
  18.    static var DEPTH_CONTENT = 10;
  19.    function Application(mc)
  20.    {
  21.       Stage.scaleMode = "noScale";
  22.       Stage.showMenu = false;
  23.       Stage.align = "TL";
  24.       this.timeline = mc;
  25.    }
  26.    static function main(mc)
  27.    {
  28.       Debugger.debug(" ---------------------------------- ");
  29.       Debugger.debug("Application().main()");
  30.       pro.videotrainingIII.Application.instance = new pro.videotrainingIII.Application(mc);
  31.       pro.videotrainingIII.Application.instance.init();
  32.    }
  33.    function init()
  34.    {
  35.       Debugger.debug(" ---------------------------------- ");
  36.       Debugger.debug("Application().init()");
  37.       pro.videotrainingIII.Application.thread.stop();
  38.       this.setAsFunctions();
  39.       this.mainData = pro.videotrainingIII.data.MainData.getInstance();
  40.       this.dictionary = de.interactivem.env.data.Dictionary.getInstance();
  41.       this.createBorder();
  42.       this.createContentController();
  43.       if(!this.isCMSPlayer())
  44.       {
  45.          this.createIntroController();
  46.       }
  47.       this.loadingController = new pro.videotrainingIII.controller.LoadingController();
  48.       this.loadingController.start();
  49.    }
  50.    function getLoadingController()
  51.    {
  52.       return this.loadingController;
  53.    }
  54.    function setFirstData()
  55.    {
  56.       this.createBorder();
  57.       this.createContentController();
  58.       this.createIntroController();
  59.    }
  60.    function setSecondData()
  61.    {
  62.       Debugger.debug(this + ".setSecondData()");
  63.       if(this.isCMSPlayer())
  64.       {
  65.          this.contentController.init();
  66.          this.startCd();
  67.       }
  68.       else
  69.       {
  70.          this.mainData.sortIndexList();
  71.          this.contentController.init();
  72.          this.introController.start();
  73.       }
  74.    }
  75.    function createBorder()
  76.    {
  77.       var _loc2_ = this.timeline.attachMovie("borderClip","borderMc",pro.videotrainingIII.Application.DEPTH_BORDER);
  78.       _loc2_.onPress = null;
  79.       _loc2_.useHandCursor = false;
  80.    }
  81.    function createDictionary()
  82.    {
  83.       this.dictionary = de.interactivem.env.data.Dictionary.getInstance();
  84.    }
  85.    function getClearText(s)
  86.    {
  87.       s = de.interactivem.env.data.utils.StringUtils.replace(s,"\r","");
  88.       return s;
  89.    }
  90.    function getFromDictionary(key)
  91.    {
  92.       var _loc2_ = this.getClearText(this.dictionary.getEntry(key));
  93.       return _loc2_ == undefined ? "" : _loc2_;
  94.    }
  95.    function getColor(key)
  96.    {
  97.       var _loc2_ = this.getFromDictionary(key);
  98.       return !(_loc2_ != undefined && _loc2_.length > 0) ? null : Number(_loc2_);
  99.    }
  100.    function getMainData()
  101.    {
  102.       return this.mainData;
  103.    }
  104.    function setMediaPath(s)
  105.    {
  106.       var _loc3_ = undefined;
  107.       var _loc4_ = de.interactivem.env.data.utils.StringUtils.hasString(s,"http://") || de.interactivem.env.data.utils.StringUtils.hasString(s,"https://");
  108.       if(_loc4_ == false)
  109.       {
  110.          _loc3_ = this.getRightPathStructur(this.getMediaPath() + s);
  111.       }
  112.       else
  113.       {
  114.          _loc3_ = s;
  115.       }
  116.       return _loc3_;
  117.    }
  118.    function createIntroController()
  119.    {
  120.       this.introController = pro.videotrainingIII.controller.IntroController.getInstance();
  121.       this.introController.create(this.timeline,pro.videotrainingIII.Application.DEPTH_INTRO);
  122.    }
  123.    function getIntroController()
  124.    {
  125.       return this.introController;
  126.    }
  127.    function createContentController()
  128.    {
  129.       this.contentController = new pro.videotrainingIII.controller.ContentController();
  130.       this.contentController.create(this.timeline,pro.videotrainingIII.Application.DEPTH_CONTENT);
  131.    }
  132.    function getContentController()
  133.    {
  134.       return this.contentController;
  135.    }
  136.    function startCd()
  137.    {
  138.       Debugger.debug(" -------------------------------------- ");
  139.       Debugger.debug(this + ".startCd()");
  140.       Debugger.debug(this + ".startCd()._quality: " + _quality);
  141.       this.contentController.checkStartOtions();
  142.       Debugger.debug(this + ".startCd(): Intro ist fertig");
  143.    }
  144.    function addCallback(methodName, instance, method)
  145.    {
  146.       var _loc1_ = netTrekLibs.com.ExternalInterface_netTrek.addCallback(methodName,instance,method);
  147.       if(_loc1_)
  148.       {
  149.          return "";
  150.       }
  151.       return "Die Funktion " + methodName + " konnte nicht angemeldet werden." + "\n";
  152.    }
  153.    function getRightPathStructur(path)
  154.    {
  155.       var _loc3_ = path;
  156.       if(this.isZinc())
  157.       {
  158.          var _loc4_ = _global.mdm.Application.path.substr(-1);
  159.          _loc3_ = de.interactivem.env.data.utils.StringUtils.replace(path,"/",_loc4_);
  160.       }
  161.       return _loc3_;
  162.    }
  163.    function getTimelineChapterId()
  164.    {
  165.       return _level0.chapterId;
  166.    }
  167.    function getTimelineLessonId()
  168.    {
  169.       return _level0.lesssonId;
  170.    }
  171.    function closeApp()
  172.    {
  173.       if(this.isOnline())
  174.       {
  175.          getUrl("JavaScript:window.close()", "");
  176.       }
  177.       else
  178.       {
  179.          _global.mdm.Application.exit();
  180.       }
  181.    }
  182.    function openLinkByLinkDataItem(dataItem)
  183.    {
  184.       var _loc2_ = dataItem.getTarget();
  185.       var _loc3_ = dataItem.getHref();
  186.       if(_loc2_ == pro.videotrainingIII.data.LinkDataItem.TARGET_INFO)
  187.       {
  188.          this.openLink(dataItem.getInfo(),_loc2_);
  189.       }
  190.       else
  191.       {
  192.          this.openLink(_loc3_,_loc2_);
  193.       }
  194.    }
  195.    function openLink(file, target)
  196.    {
  197.       if(this.getMainData().getSharedObjectData().getInternetTransfer() && target == pro.videotrainingIII.data.LinkDataItem.TARGET_BLANK && de.interactivem.env.data.utils.SystemUtils.isOnlineLink(file))
  198.       {
  199.          this.contentController.getInfoPopUp().onOkay = de.interactivem.env.events.Delegate.create(this,this.openLinkDirekt,file,target);
  200.          this.contentController.getInfoPopUp().setOnShowInfo(de.interactivem.env.events.Delegate.create(this.contentController.getHelpWindowController().getSettingsController(),this.contentController.getHelpWindowController().getSettingsController().setInternetTransfer),this.getMainData().getSharedObjectData().getInternetTransfer());
  201.          this.contentController.startInfoPopUp(this.getFromDictionary("internetTransferMessage"));
  202.       }
  203.       else
  204.       {
  205.          this.openLinkDirekt(file,target);
  206.       }
  207.    }
  208.    function openLinkDirekt(file, target)
  209.    {
  210.       if(target == pro.videotrainingIII.data.LinkDataItem.TARGET_BLANK)
  211.       {
  212.          if(this.isZinc())
  213.          {
  214.             if(this.isWindows())
  215.             {
  216.                _global.mdm.System.exec(file);
  217.             }
  218.             else
  219.             {
  220.                _global.mdm.MacShell.exec("open " + file);
  221.             }
  222.          }
  223.          else
  224.          {
  225.             getURL(file,"_blank");
  226.          }
  227.       }
  228.       else if(target == pro.videotrainingIII.data.LinkDataItem.TARGET_PATH)
  229.       {
  230.          if(this.isZinc())
  231.          {
  232.             var _loc6_ = this.getRightPathStructur(this.getApplicationPath() + file);
  233.             _global.mdm.System.exec(_loc6_);
  234.          }
  235.          else
  236.          {
  237.             getURL(this.getApplicationPath() + file,"_blank");
  238.          }
  239.       }
  240.       else if(target == pro.videotrainingIII.data.LinkDataItem.TARGET_MAIL)
  241.       {
  242.          var _loc5_ = "mailto:" + file;
  243.          if(this.isZinc())
  244.          {
  245.             if(this.isWindows())
  246.             {
  247.                _global.mdm.System.exec(_loc5_);
  248.             }
  249.             else
  250.             {
  251.                _global.mdm.MacShell.exec("open " + _loc5_);
  252.             }
  253.          }
  254.          else
  255.          {
  256.             getURL("mailto:" + file,"");
  257.          }
  258.       }
  259.       else if(target == pro.videotrainingIII.data.LinkDataItem.TARGET_INFO)
  260.       {
  261.          this.getContentController().getInfoPopUp().start(file);
  262.       }
  263.    }
  264.    function setAsFunctions()
  265.    {
  266.       MovieClip.prototype.asOpenLink = de.interactivem.env.events.Delegate.create(this,this.asOpenLink);
  267.       MovieClip.prototype.asOpenLinkDirekt = de.interactivem.env.events.Delegate.create(this,this.asOpenLinkDirekt);
  268.    }
  269.    function asOpenLinkDirekt(p)
  270.    {
  271.       var _loc2_ = p.split(",");
  272.       var _loc3_ = _loc2_[0];
  273.       var _loc4_ = _loc2_[1];
  274.       this.openLinkDirekt(_loc3_,_loc4_);
  275.    }
  276.    function asOpenLink(p)
  277.    {
  278.       var _loc2_ = p.split(",");
  279.       var _loc3_ = _loc2_[0];
  280.       var _loc4_ = _loc2_[1];
  281.       this.openLink(_loc3_,_loc4_);
  282.    }
  283.    function isSystemTypeWindows()
  284.    {
  285.       return de.interactivem.env.data.utils.SystemUtils.isSystemTypeWindows();
  286.    }
  287.    function isSystemTypeMacOS()
  288.    {
  289.       return de.interactivem.env.data.utils.SystemUtils.isSystemTypeMacOS();
  290.    }
  291.    function isSystemTypeLinux()
  292.    {
  293.       return de.interactivem.env.data.utils.SystemUtils.isSystemTypeLinux();
  294.    }
  295.    function isOnline()
  296.    {
  297.       var _loc2_ = _global.mdm.Application.path == undefined;
  298.       return _loc2_;
  299.    }
  300.    function isZinc()
  301.    {
  302.       var _loc2_ = _global.mdm.Application.path != undefined;
  303.       return _loc2_;
  304.    }
  305.    function isMac()
  306.    {
  307.       var _loc1_ = de.interactivem.env.data.utils.SystemUtils.isSystemTypeMacOS();
  308.       return _loc1_;
  309.    }
  310.    function isWindows()
  311.    {
  312.       var _loc1_ = de.interactivem.env.data.utils.SystemUtils.isSystemTypeWindows();
  313.       return _loc1_;
  314.    }
  315.    function getSystemType()
  316.    {
  317.       if(this.isOnline())
  318.       {
  319.          return de.interactivem.env.data.utils.SystemUtils.PLAYER_TYPE_ONLINE;
  320.       }
  321.       if(this.isWindows())
  322.       {
  323.          return de.interactivem.env.data.utils.SystemUtils.SYSTEM_TYPE_WINDOWS;
  324.       }
  325.       if(this.isMac())
  326.       {
  327.          return de.interactivem.env.data.utils.SystemUtils.SYSTEM_TYPE_MACOS;
  328.       }
  329.    }
  330.    function isCMSPlayer()
  331.    {
  332.       return de.interactivem.gui.utils.MovieClipUtils.getRootVar("cms") == "1";
  333.    }
  334.    function getTimeline()
  335.    {
  336.       return this.timeline;
  337.    }
  338.    function getApplicationPath()
  339.    {
  340.       var _loc3_ = this.mainData.getAppData().getGateway();
  341.       var _loc4_ = de.interactivem.gui.utils.MovieClipUtils.getRootVar("url");
  342.       var _loc5_ = _global.mdm.Application.path;
  343.       if(this.isZinc())
  344.       {
  345.          _loc3_ = _loc5_;
  346.       }
  347.       else if(_loc4_ != null)
  348.       {
  349.          _loc3_ = _loc4_;
  350.       }
  351.       else if(_loc3_ == undefined)
  352.       {
  353.          _loc3_ = "";
  354.       }
  355.       return _loc3_;
  356.    }
  357.    function getFolder(folder)
  358.    {
  359.       var _loc2_ = this.getApplicationPath() + this.getRightPathStructur(folder);
  360.       return _loc2_;
  361.    }
  362.    function getMediaPath()
  363.    {
  364.       return this.getFolder(this.mainData.getAppData().getFolderName());
  365.    }
  366.    function getDataPath()
  367.    {
  368.       var _loc2_ = "system/data/";
  369.       var _loc4_ = de.interactivem.gui.utils.MovieClipUtils.getRootVar("dataPath");
  370.       var _loc3_ = this.mainData.getAppData().getDataPath();
  371.       if(_loc4_ != null)
  372.       {
  373.          _loc2_ = _loc4_;
  374.       }
  375.       else if(_loc3_ != null)
  376.       {
  377.          _loc2_ = _loc3_;
  378.       }
  379.       return this.getFolder(_loc2_);
  380.    }
  381.    static function getInstance()
  382.    {
  383.       return pro.videotrainingIII.Application.instance;
  384.    }
  385.    function toString()
  386.    {
  387.       return "Application";
  388.    }
  389. }
  390.