/** * ExpressInstall implementation to compil and use with * SWFObject 1.5 and newer script. * *
In fact, auto install developped in FeverInstall class does not * work any more with SWFObject 1.5 as it waiting for a .swf filename to * allow ExpressInstall process. * *
SWFObject 1.5 ExpressInstall technic
*
* so.useExpressInstall('expressinstall.swf');
*
*
* @author Romain Ecarnot
*/
class fever.install.ExpressInstall
{
//-------------------------------------------------------------------------
// Private properties
//-------------------------------------------------------------------------
private var _updater : MovieClip;
private var _hold : MovieClip;
//-------------------------------------------------------------------------
// Public API
//-------------------------------------------------------------------------
/**
* MTASC Access point
*/
public static function main( container : MovieClip ) : Void
{
Stage.scaleMode = 'noscale';
( new ExpressInstall() ).loadUpdater( container );
}
public function loadUpdater( target : MovieClip ) : Void
{
System.security.allowDomain( 'fpdownload.macromedia.com' );
var self = this;
_updater = target.createEmptyMovieClip( 'dei', 10000007 );
_updater.installStatus = _onInstallStatus;
_updater.onEnterFrame = function() : Void {
if ( typeof self._hold.startUpdate == 'function' )
{
self._initUpdater( target );
this.onEnterFrame = null;
}
};
_hold = _updater.createEmptyMovieClip( 'hold', 1 );
_hold.loadMovie( 'http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?' + Math.random() );
}
//-------------------------------------------------------------------------
// Private implementation
//-------------------------------------------------------------------------
private function ExpressInstall() {}
private function _initUpdater( target : MovieClip ) : Void
{
_hold.redirectURL = target.MMredirectURL;
_hold.MMplayerType = target.MMplayerType;
_hold.MMdoctitle = target.MMdoctitle;
_hold.startUpdate();
}
private function _onInstallStatus( msg ) : Void
{
if ( msg == 'Download.Complete' )
{
//auto redirection.
}
else if ( msg == 'Download.Cancelled' )
{
getURL( "javascript:alert( 'Le contenu de ce site necessite une version plus recente du Adobe Flash Player.' )" );
}
else if ( msg == 'Download.Failed' )
{
getURL( "javascript:alert( 'Erreur pendant le telechargement de la mise a jour. Merci de visiter le site adobe.com/go/getflashplayer/.' )" );
}
}
}