欢迎来到福编程网,本站提供各种互联网专业知识!

另类调用flash无须激活的方法

发布时间:2006-12-27 作者: 来源:转载
复制代码代码如下:/***SWFObjectv1.4:FlashPlayerdetectionandembed-http://blog.deconcept.com/swfobject/**SWFObjectis(c)2006GeoffStearnsandisreleasedundertheMITLicense:*http://www.opensource.org/licenses/mit-license.php****SWFObjectisth
复制代码 代码如下:
/**
*SWFObjectv1.4:FlashPlayerdetectionandembed-http://blog.deconcept.com/swfobject/
*
*SWFObjectis(c)2006GeoffStearnsandisreleasedundertheMITLicense:
*http://www.opensource.org/licenses/mit-license.php
*
***SWFObjectistheSWFembedscriptformerlyknownasFlashObject.Thenamewaschangedfor
*legalreasons.
*/
if(typeofdeconcept=="undefined"){vardeconcept=newObject();}
if(typeofdeconcept.util=="undefined"){deconcept.util=newObject();}
if(typeofdeconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=newObject();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=newObject();
this.variables=newObject();
this.attributes=newArray();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",newdeconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
varq=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var_d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
returnthis.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
returnthis.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
returnthis.variables[_15];
},getVariables:function(){
returnthis.variables;
},getVariablePairs:function(){
var_16=newArray();
varkey;
var_18=this.getVariables();
for(keyin_18){
_16.push(key+"="+_18[key]);}
return_16;
},getSWFHTML:function(){
var_19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="_19+="id=""+this.getAttribute("id")+""name=""+this.getAttribute("id")+""";
var_1a=this.getParams();
for(varkeyin_1a){_19+=[key]+"=""+_1a[key]+""";}
var_1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=""+_1c+""";}
_19+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="";
_19+="";
var_1d=this.getParams();
for(varkeyin_1d){_19+="";}
var_1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="";}
_19+="";}
return_19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var_21=newdeconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+"-FlashPlayerInstallation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
varn=(typeof_20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
returntrue;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
returnfalse;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){
var_25=newdeconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
varx=navigator.plugins["ShockwaveFlash"];
if(x&&x.description){_25=newdeconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|s)+/,"").replace(/(s+r|s+b[0-9]+)/,".").split("."));}
}else{try{
varaxo=newActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(vari=3;axo!=null;i++){
axo=newActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_25=newdeconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return_25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=newdeconcept.PlayerVersion(axo.GetVariable("$version").split("")[1].split(","));}
catch(e){}}}
return_25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=parseInt(_29[2])||0;};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.majorif(this.major>fv.major){returntrue;}
if(this.minorif(this.minor>fv.minor){returntrue;}
if(this.revdeconcept.util={getRequestParameter:function(_2b){
varq=document.location.search||document.location.hash;
if(q){
var_2d=q.indexOf(_2b+"=");
var_2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){
returnq.substring(q.indexOf("=",_2d)+1,_2e);
}}return"";}};
if(Array.prototype.push==null){
Array.prototype.push=function(_2f){
this[this.length]=_2f;
returnthis.length;};}
vargetQueryParamValue=deconcept.util.getRequestParameter;
varFlashObject=deconcept.SWFObject;//forbackwardscompatibility
varSWFObject=deconcept.SWFObject;



使用方法:
复制代码 代码如下:






varfo=newSWFObject("yanyuan.swf","mymyy","580","386","7","");
fo.addParam("quality","best");
fo.addParam("salign","t");
fo.addParam("scale","noscale");
fo.addParam("loop","true");
fo.write("flashmovyy");


相关推荐