FDT Pixlib template ExpressInstall

Tags : , ,
<?xml version="1.0" encoding="UTF-8"?><templates><template autoinsert="true" context="com.pf.fdt.ui.editor.template.actionscript" deleted="false" description="template for Adobe Express installation" enabled="true" name="expressInstall">/**&#13;
 * ExpressInstall class v0.91 - http://blog.deconcept.com/flashobject/&#13;
 * &#13;
 * 08-12-2005 (c) 2005 Geoff Stearns and is released under the MIT License:&#13;
 * http://www.opensource.org/licenses/mit-license.php&#13;
 *&#13;
 * Use this class to invoke the Macromedia Flash Player Express Install functionality&#13;
 * This file is intended for use with the FlashObject embed script. You can download FlashObject &#13;
 * and this class here: http://blog.deconcept.com/flashobject/&#13;
 *&#13;
 * Usage: Place this file in your AS2 class path.&#13;
 *        on the first frame of your Flash movie, place this line of code:&#13;
 *        &#13;
 *        ExpressInstall.init();&#13;
 *        &#13;
 *        You should not place any other code on the first frame of your movie, as the first frame&#13;
 *        needs to be playable in the Flash player v. 6.0.65.&#13;
 *&#13;
 */&#13;
&#13;
class ${enclosing_package_and_type} &#13;
{&#13;
&#13;
   private var updater:MovieClip;&#13;
   private var hold:MovieClip;&#13;
   private static var instance:ExpressInstall;&#13;
&#13;
   function ExpressInstall() {}&#13;
&#13;
   public static function init():Boolean &#13;
   {&#13;
      // if MMplayerType is not set, the var was not passed in&#13;
      // from the FlashObject embed, so the upgrade is not needed&#13;
      if (_root.MMplayerType == undefined) &#13;
      {&#13;
         return false;&#13;
      }&#13;
      ExpressInstall.getInstance().loadUpdater();&#13;
      return true;&#13;
   }&#13;
&#13;
   public static function getInstance():ExpressInstall &#13;
   {&#13;
      if (instance == null) &#13;
      {&#13;
         instance = new ExpressInstall();&#13;
      }&#13;
      return instance;&#13;
   }&#13;
&#13;
   private function loadUpdater():Void &#13;
   {&#13;
      System.security.allowDomain("fpdownload.macromedia.com");&#13;
&#13;
      // hope that nothing is at a depth of 10000000, you can change this depth if needed, but you want&#13;
      // it to be on top of your content if you have any stuff on the first frame&#13;
      this.updater = _root.createEmptyMovieClip("expressInstallHolder", 10000000);&#13;
      // register the callback so we know if they cancel or there is an error&#13;
      this.updater.installStatus = this.installStatus;&#13;
      this.hold = this.updater.createEmptyMovieClip("hold", 1);&#13;
&#13;
      // can't use movieClipLoader because it has to work in 6.0.65&#13;
      this.updater.onEnterFrame = function() &#13;
      {&#13;
         if (typeof this.hold.startUpdate == 'function') &#13;
         {&#13;
            ExpressInstall.getInstance().loadInit();&#13;
            delete this.onEnterFrame;&#13;
         }&#13;
      };&#13;
&#13;
      var cacheBuster = Math.random();&#13;
      this.hold.loadMovie("http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?"+ cacheBuster);&#13;
   }&#13;
&#13;
   public function loadInit() &#13;
   {&#13;
      this.hold.redirectURL = _root.MMredirectURL;&#13;
      this.hold.MMplayerType = _root.MMplayerType;&#13;
      this.hold.MMdoctitle = _root.MMdoctitle;&#13;
      this.hold.startUpdate();&#13;
   }&#13;
&#13;
   public function installStatus(statusValue):Void {&#13;
      if (statusValue == "Download.Complete") &#13;
      {&#13;
         // Installation is complete. In most cases the browser window that this SWF &#13;
         // is hosted in will be closed by the installer or manually by the end user&#13;
         getURL("javascript:window.opener=self;self.close()");&#13;
      } else if (statusValue == "Download.Cancelled") &#13;
      {&#13;
         // The end user chose "NO" when prompted to install the new player&#13;
         // by default no User Interface is presented in this case. It is left up to &#13;
         // the developer to provide an alternate experience in this case&#13;
&#13;
         // feel free to change this to whatever you want, js errors are sufficient for this example&#13;
         getURL("javascript:alert('This content requires a more recent version of the Macromedia Flash Player.')");&#13;
      } else if (statusValue == "Download.Failed") &#13;
      {&#13;
         // The end user failed to download the installer due to a network failure&#13;
         // by default no User Interface is presented in this case. It is left up to &#13;
         // the developer to provide an alternate experience in this case&#13;
&#13;
         // feel free to change this to whatever you want, js errors are sufficient for this example&#13;
         getURL("javascript:alert('There was an error in downloading the Flash Player update. Please try again later, or visit macrmedia.com to download the latest version of the Flash plugin.')");&#13;
      }&#13;
   }&#13;
}</template></templates>