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