]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojox/flash/ExpressInstall.as
add Dojo 1.1.1
[eow] / static / dojo-release-1.1.1 / dojox / flash / ExpressInstall.as
1 /**\r
2  * Based on the expressinstall.as class created by Geoff Stearns as part\r
3  * of the FlashObject library.\r
4  *\r
5  * Use this file to invoke the Macromedia Flash Player Express Install functionality\r
6  * This file is intended for use with the FlashObject embed script. You can download FlashObject \r
7  * and this file at the following URL: http://blog.deconcept.com/flashobject/\r
8  *\r
9  * Usage: \r
10  *          var ExpressInstall = new ExpressInstall();\r
11  *          \r
12  *          // test to see if install is needed:\r
13  *          if (ExpressInstall.needsUpdate) { // returns true if update is needed\r
14  *              ExpressInstall.init(); // starts the update\r
15  *          }\r
16  *\r
17  *      NOTE: Your Flash movie must be at least 214px by 137px in order to use ExpressInstall.\r
18  *\r
19  */\r
20 \r
21 class ExpressInstall{\r
22         public var needsUpdate:Boolean;\r
23         private var updater:MovieClip;\r
24         private var hold:MovieClip;\r
25         \r
26         public function ExpressInstall(){\r
27                 // does the user need to update?\r
28                 this.needsUpdate = (_root.MMplayerType == undefined) ? false : true;    \r
29         }\r
30 \r
31         public function init():Void{\r
32                 this.loadUpdater();\r
33         }\r
34 \r
35         public function loadUpdater():Void{\r
36                 System.security.allowDomain("fpdownload.macromedia.com");\r
37 \r
38                 // hope that nothing is at a depth of 10000000, you can change this depth if needed, but you want\r
39                 // it to be on top of your content if you have any stuff on the first frame\r
40                 this.updater = _root.createEmptyMovieClip("expressInstallHolder", 10000000);\r
41 \r
42                 // register the callback so we know if they cancel or there is an error\r
43                 var _self = this;\r
44                 this.updater.installStatus = _self.onInstallStatus;\r
45                 this.hold = this.updater.createEmptyMovieClip("hold", 1);\r
46 \r
47                 // can't use movieClipLoader because it has to work in 6.0.65\r
48                 this.updater.onEnterFrame = function():Void {\r
49                         if(typeof this.hold.startUpdate == 'function'){\r
50                                 _self.initUpdater();\r
51                                 this.onEnterFrame = null;\r
52                         }\r
53                 }\r
54 \r
55                 var cacheBuster:Number = Math.random();\r
56 \r
57                 this.hold.loadMovie("http://fpdownload.macromedia.com/pub/flashplayer/"\r
58                                                                                                 +"update/current/swf/autoUpdater.swf?"+ cacheBuster);\r
59         }\r
60 \r
61         private function initUpdater():Void{\r
62                 this.hold.redirectURL = _root.MMredirectURL;\r
63                 this.hold.MMplayerType = _root.MMplayerType;\r
64                 this.hold.MMdoctitle = _root.MMdoctitle;\r
65                 this.hold.startUpdate();\r
66         }\r
67 \r
68         public function onInstallStatus(msg):Void{\r
69                 getURL("javascript:dojox.flash.install._onInstallStatus('"+msg+"')");\r
70         }\r
71 }\r