SWF加载和flash播放器升级

时间:2011-10-18 05:41:17

标签: javascript dom flash swfobject

我目前正在制作Flash游戏。为了确保用户体验一致,我尝试使用以下代码段指定swfVersion并调用“swfobject.embedSWF()”。

PD.prototype.loadGame=function(){
var flashvars=this.bootData;
var swfVersion = "11.0.1.152";
var xiSwfUrl = "playerProductInstall.swf";
var params = {
    quality: 'high',
    bgcolor: '#ffffff',
    allowscriptaccess: 'always',
    allowfullscreen: 'true',
    wmode:'opaque'
};
var attributes = {
    id:'Main',
    name:'Main',
    align:'middle'
};

var ref=this;
var mainUrl=this.main+this.version+'&t='+(new Date()).getTime();
swfobject.embedSWF(mainUrl, "flashContent", "100%", "590", swfVersion, this.staticPath+xiSwfUrl, flashvars, params, attributes, function(obj){
    if(obj.success){
        ref.swf=obj.ref;
        $(window).resize(function(){
            var width=$('div#flashContentDiv').width();
            ref.swf.setSize(width,590);
        });
    }else{
        $('div#flashContentDiv').css('background','#ffffff');
        $('div#flashContentDiv').html('<div style="padding-top:250px">Please download the latest version of Flash Player from <a target="_blank" href="http://get.adobe.com/flashplayer/">here</a></div>');
    }
});
};

但是,我仍然会让用户报告升级后无法加载SWF的情况。我应该只指定主要版本吗?

1 个答案:

答案 0 :(得分:0)

请参阅SWFObject docs

  

version(String,required)指定SWF的Flash播放器版本   发表(格式为:“major.minor.release”或“major”)

你指定的不仅仅是major.minor.release。尝试简化到

var swfVersion = "11.0.1";