~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to lib/swfobject/src/expressInstall.as

  • Committer: Keith Hughitt
  • Date: 2012-06-12 20:18:46 UTC
  • Revision ID: keith.hughitt@gmail.com-20120612201846-k3nm2g2sznpfumhc
Added latest movies page

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*      SWFObject v2.2 <http://code.google.com/p/swfobject/> is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
 
2
        Express Install Copyright (c) 2007-2008 Adobe Systems Incorporated and its licensors. All Rights Reserved.
 
3
*/
 
4
 
 
5
System.security.allowDomain("fpdownload.macromedia.com");
 
6
 
 
7
var time = 0;
 
8
var timeOut = 5; // in seconds
 
9
var delay = 10; // in milliseconds
 
10
var int_id = setInterval(checkLoaded, delay);
 
11
var old_si = null;
 
12
var loaderClip = this.createEmptyMovieClip("loaderClip", 0);
 
13
var updateSWF = "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?" + Math.random();
 
14
loaderClip.loadMovie(updateSWF);
 
15
 
 
16
function checkLoaded(){
 
17
        time += delay / 1000;
 
18
        if (time > timeOut) {
 
19
                // updater did not load in time, abort load and force alternative content
 
20
                clearInterval(int_id);
 
21
                loaderClip.unloadMovie();
 
22
                loadTimeOut();
 
23
        }
 
24
        else if (loaderClip.startInstall.toString() == "[type Function]") {
 
25
                // updater has loaded successfully AND has determined that it can do the express install
 
26
                if (old_si == null) {
 
27
                        old_si = loaderClip.startInstall;
 
28
                        loaderClip.startInstall = function() {
 
29
                                clearInterval(int_id);
 
30
                                old_si();
 
31
                        }
 
32
                        loadComplete();
 
33
                }
 
34
        }       
 
35
}
 
36
 
 
37
function loadTimeOut() {
 
38
        callbackSWFObject();
 
39
}
 
40
 
 
41
function callbackSWFObject() {
 
42
        getURL("javascript:swfobject.expressInstallCallback();");
 
43
}
 
44
 
 
45
function loadComplete() {
 
46
        loaderClip.redirectURL = _level0.MMredirectURL;
 
47
        loaderClip.MMplayerType = _level0.MMplayerType;
 
48
        loaderClip.MMdoctitle = _level0.MMdoctitle;
 
49
        loaderClip.startUpdate();
 
50
}
 
51
 
 
52
function installStatus(statusValue) {
 
53
        switch (statusValue) {
 
54
                case "Download.Complete":
 
55
                        // Installation is complete.
 
56
                        // In most cases the browser window that this SWF is hosted in will be closed by the installer or otherwise it has to be closed manually by the end user.
 
57
                        // The Adobe Flash installer will attempt to reopen the browser window and reload the page containing the SWF. 
 
58
                break;
 
59
                case "Download.Cancelled":
 
60
                        // The end user chose "NO" when prompted to install the new player.
 
61
                        // By default the SWFObject callback function is called to force alternative content.
 
62
                        callbackSWFObject();
 
63
                break;
 
64
                case "Download.Failed":
 
65
                        // The end user failed to download the installer due to a network failure.
 
66
                        // By default the SWFObject callback function is called to force alternative content.
 
67
                        callbackSWFObject();
 
68
                break;
 
69
        }
 
70
}