PDA

Просмотр полной версии : Траблы SWFObject, не видно флехи в HTML-ке!!!


Inverse_Design
21.07.2006, 20:50
Цель такова, нужно создать хтмл page, в которой находиться флеха, то есть нужно:
- проверить версию флеш плеера у клиена;
- если версия плеера ниже 8-й, выполняеться сам expressInstall с корорым разбираюсь, обновление плеера до нужной версии и перегрузка сайта, reload...

html код...

<div align="center" id "flashcontent"></div>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var so = new SWFObject("efi-trance.swf","myFlashMovie","768","800","8","#FFFFFF",true);
so.write("flashcontent");
</script>
fla код...
в первом кадре
#include "expressinstall.as"

Описание файла expressinstall.as:
var ExpressInstall = function():Void {
// does the user need to update?
this.needsUpdate = (_root.MMplayerType == undefined) ? false : true;
}

ExpressInstall.prototype = {
init: function():Boolean {
if (this.needsUpdate) {
this.loadUpdater();
return true;
} else {
return false;
}
},

loadUpdater: function():Void {
System.security.allowDomain("fpdownload.macromedia.com");

// hope that nothing is at a depth of 10000000, you can change this depth if needed, but you want
// it to be on top of your content if you have any stuff on the first frame
this.updater = _root.createEmptyMovieClip("expressInstallHolder", 10000000);

// register the callback so we know if they cancel or there is an error
var _self = this;
this.updater.installStatus = _self.onInstallStatus;
this.hold = this.updater.createEmptyMovieClip("hold", 1);

// can't use movieClipLoader because it has to work in 6.0.65
this.updater.onEnterFrame = function():Void {
if (typeof this.hold.startUpdate == 'function') {
_self.initUpdater();
this.onEnterFrame = null;
}
}

var cacheBuster:Number = Math.random();
this.hold.loadMovie("http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?"+ cacheBuster);
},

initUpdater: function():Void {
this.hold.redirectURL = _root.MMredirectURL;
this.hold.MMplayerType = _root.MMplayerType;
this.hold.MMdoctitle = _root.MMdoctitle;
this.hold.startUpdate();
},

onInstallStatus: function(msg):Void {
if (msg == "Download.Complete") {
// Installation is complete. In most cases the browser window that this SWF
// is hosted in will be closed by the installer or manually by the end user
} else if (msg == "Download.Cancelled") {
// The end user chose "NO" when prompted to install the new player
// by default no User Interface is presented in this case. It is left up to
// the developer to provide an alternate experience in this case

// feel free to change this to whatever you want, js errors are sufficient for this example
getURL("javascript:alert('This content requires a more recent version of the Macromedia Flash Player.')");
} else if (msg == "Download.Failed") {
// The end user failed to download the installer due to a network failure
// by default no User Interface is presented in this case. It is left up to
// the developer to provide an alternate experience in this case

// feel free to change this to whatever you want, js errors are sufficient for this example
getURL("javascript:alert('There was an error downloading the Flash Player update. Please try again later, or visit macromedia.com to download the latest version of the Flash plugin.')");
}
}
}


Помогите, я пока в away...далее буду разбираться, мож поможете будет быстрее...;) ;) ;)

P.S. Вопрос к знатокам =)

Inverse_Design
21.07.2006, 21:23
Тот кто юзал SWFObject Им файлик этот не нужен, он наверняка у них есть, как же без него, кто не знает что такое = swfobject.js, в топик не отписывать -)))