欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2023-12-05 20:44:52
复制代码 代码如下: /**   * swfobject&...
复制代码 代码如下:
<script type="text/javascript">
/** 
 * swfobject v1.4: flash player detection and embed - http://blog.deconcept.com/swfobject/ 
 * 
 * swfobject is (c) 2006 geoff stearns and is released under the mit license: 
 * http://www.opensource.org/licenses/mit-license.php 
 * 
 * **swfobject is the swf embed script formerly known as flashobject. the name was changed for 
 *   legal reasons. 
 */ 
if(typeof deconcept=="undefined"){var deconcept=new object();} 
if(typeof deconcept.util=="undefined"){deconcept.util=new object();} 
if(typeof deconcept.swfobjectutil=="undefined"){deconcept.swfobjectutil=new object();} 
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=new object(); 
this.variables=new object(); 
this.attributes=new array(); 
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",new deconcept.playerversion(_5.tostring().split(".")));} 
this.installedver=deconcept.swfobjectutil.getplayerversion(this.getattribute("version"),_7); 
if(c){this.addparam("bgcolor",c);} 
var q=_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){ 
return this.attributes[_10]; 
},addparam:function(_11,_12){ 
this.params[_11]=_12; 
},getparams:function(){ 
return this.params; 
},addvariable:function(_13,_14){ 
this.variables[_13]=_14; 
},getvariable:function(_15){ 
return this.variables[_15]; 
},getvariables:function(){ 
return this.variables; 
},getvariablepairs:function(){ 
var _16=new array(); 
var key; 
var _18=this.getvariables(); 
for(key in _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="<embed type=\"application/x-shockwave-flash\" src=\""+this.getattribute("swf")+"\" width=\""+this.getattribute("width")+"\" height=\""+this.getattribute("height")+"\""; 
_19+=" id=\""+this.getattribute("id")+"\" name=\""+this.getattribute("id")+"\" "; 
var _1a=this.getparams(); 
for(var key in _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="<object id=\""+this.getattribute("id")+"\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\""+this.getattribute("width")+"\" height=\""+this.getattribute("height")+"\">"; 
_19+="<param name=\"movie\" value=\""+this.getattribute("swf")+"\" />"; 
var _1d=this.getparams(); 
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";} 
var _1f=this.getvariablepairs().join("&"); 
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";} 
_19+="</object>";} 
return _19; 
},write:function(_20){ 
if(this.getattribute("useexpressinstall")){ 
var _21=new deconcept.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)+" - flash player installation"; 
this.addvariable("mmdoctitle",document.title);}} 
if(this.skipdetect||this.getattribute("doexpressinstall")||this.installedver.versionisvalid(this.getattribute("version"))){ 
var n=(typeof _20=="string")?document.getelementbyid(_20):_20; 
n.innerhtml=this.getswfhtml(); 
return true; 
}else{ 
if(this.getattribute("redirecturl")!=""){document.location.replace(this.getattribute("redirecturl"));}} 
return false;}}; 
deconcept.swfobjectutil.getplayerversion=function(_23,_24){ 
var _25=new deconcept.playerversion([0,0,0]); 
if(navigator.plugins&&navigator.mimetypes.length){ 
var x=navigator.plugins["shockwave flash"]; 
if(x&&x.description){_25=new deconcept.playerversion(x.description.replace(/([a-z]|[a-z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));} 
}else{try{ 
var axo=new activexobject("shockwaveflash.shockwaveflash"); 
for(var i=3;axo!=null;i++){ 
axo=new activexobject("shockwaveflash.shockwaveflash."+i); 
_25=new deconcept.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=new deconcept.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.major<fv.major){return false;} 
if(this.major>fv.major){return true;} 
if(this.minor<fv.minor){return false;} 
if(this.minor>fv.minor){return true;} 
if(this.rev<fv.rev){return false;}return true;}; 
deconcept.util={getrequestparameter:function(_2b){ 
var q=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){ 
return q.substring(q.indexof("=",_2d)+1,_2e); 
}}return "";}}; 
if(array.prototype.push==null){ 
array.prototype.push=function(_2f){ 
this[this.length]=_2f; 
return this.length;};} 
var getqueryparamvalue=deconcept.util.getrequestparameter; 
var flashobject=deconcept.swfobject; // for backwards compatibility 
var swfobject=deconcept.swfobject; 


</script> 

使用方法:
复制代码 代码如下:
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style>
<table width="10%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div id="flashmovyy" ></div>
    <script type="text/javascript">   
   var fo = new swfobject("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");   
 </script></td>
  </tr>
</table>