flash 自适应代码

今天我们来看看如何制作flash 自适应屏幕代码.我们先来看看html代码.

  <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="1010" HEIGHT="630">
    <PARAM NAME=movie VALUE="flash/index.swf">
<PARAM NAME=menu VALUE=false>
<PARAM NAME=quality VALUE=high>
<PARAM NAME="wmode" value="opaque" / >
<PARAM NAME=bgcolor VALUE=#d8d8d8>

<EMBED src="flash/index.swf" menu=false quality=high bgcolor=#000000  WIDTH="100%" HEIGHT="100%" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>
<param name="wmode" value="transparent">
<param name="wmode" value="Opaque">

<SCRIPT type="text/javascript">
 var so = new SWFObject("flash/index.swf", "fmovie", "100%", "100%", "8", "#fff");
 so.write("flashcontent");
</SCRIPT>

下面会用到一个js文件,主要控制在这查js代码里面了.

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.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();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.addParam("menu",false);
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(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|s)+/,"").replace(/(s+r|s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[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(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
好了,你把这下面一段代码保存到一个js文件,或直接在html中也可以.好了就这么多了,转载的朋友请注明来处吧.  www.111cn.net/flash_a/flash.html

时间: 2024-09-20 06:04:00

flash 自适应代码的相关文章

让Flash 自适应浏览器屏幕大小

浏览器|自适应 要让flash自适应浏览器屏幕大小需要做到以下两点:1.swf文件随着浏览器屏幕大小也相应改变大下:方法:在网页里除了放你的swf文件外不要放其他的任何内容,并且swf文件的宽,高都设为100%;(可以看我的源文件里的fullscreen.htm文件): 2.当swf文件大小改变时,flash 内容也相应重新安排. 在这个例子里,我在主舞台上使用了一loader组件来载入一张图片.当你调整浏览器大小时,swf文件大下相应发生变化.我使用了Stage 对象的onReisize事件来

网页Flash播放代码的一个小技巧

flash播放|技巧|网页 网页Flash播放代码的一个小技巧 很多网页中都插有Flash播放代码,这不仅是为了页面元素的多样化,更是为了内容体现的需要.很多时候,我们会遇到这样的问题:根据需要使用Flash的script来读取不同的音频源或者视频源,那么如何实现这一功能呢?下面我们用改写<object>标签中的代码来实现. 一个典型的Flash播放器源代码中常常有这样的语句:<param name="movie" value="http://mydomin

如何养成Flash ActionScript代码编写好习惯

每个人玩Flash一段时间后,都会形成自己的一套Flash ActionScript代码编写习惯.好的代码编写习惯可以尽可能避免低级失误和不必要的麻烦,从而加速开发进程,提高开发质量.火山现在虽然只是业余爱好者,但两年的积累,再加上"火山之家"的开发,也自然而然的形成了火山特色的开发习惯.这些习惯从某种程度反映了我现在的开发水平,所以它基本上都是围绕着小型.快捷.面向过程的开发模式形成的,很多地方还很幼稚.不过以后随着我能力的不断提高,以及对面向对象编程思想的学习,它肯定还要不断的更新

flash倒计时代码

flash倒计时代码//此处进行类声明,注意,类名称要与前面的as文件名一致 class TaoshawCountDown { //定义变量开始 //定义重复调用函数的名称 private var my_ID:Number; private var my_Second:Number; //定义倒计时的总时间 private var my_Total:Number; //定义倒计时完后,跳转的帧数 private var my_Frame:Number; static var my_Length:

Js动态设置rem来实现移动端字体的自适应代码_javascript技巧

下面一段代码给大家介绍了Js动态设置rem来实现移动端字体的自适应,以此做个记录,方便以后需要,感兴趣的朋友一起看看吧. 具体代码如下所示: //设置根元素字体 var win = window, doc = document; function setFontSize() { var winWidth = $(window).width(); //750这个数字是根据你的设计图的实际大小来的,所以值具体根据设计图的大小 var size = (winWidth / 750) * 100; do

css 高度自适应代码与自适应高度css兼容ie,firefox

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>css 高度自适应代码与自适应高度css兼容ie,firefox</title> </head> <style t

flash 自适应屏幕代码

<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> <![CDATA[ [Embed(source="index.swf")] [Bindable] private var swf:Class; ]]> </mx:Script> <mx:SWFLoader sourc

网页教学网推荐:Flash常用代码的介绍

网页 1.用flash 做那种弹出的小窗口 分两步: 给flash中的按钮加入如下action: on (release) { getURL ("BLOCKED SCRIPTMM_openBrWindow('newweb.htm','','width=600,height=100')"); } 在HTML页面的...之间加入下面的javascript代码. 2.如何使得flash一打开就是全屏? fscommand("fullscreen",true) 如何不能使用

Flash常用代码的介绍

1.用flash 做那种弹出的小窗口 分两步: 给flash中的按钮加入如下action: on (release) { getURL ("BLOCKED SCRIPTMM_openBrWindow('newweb.htm','','width=600,height=100')"); } 在HTML页面的...之间加入下面的javascript代码. 2.如何使得flash一打开就是全屏? fscommand("fullscreen",true) 如何不能使用右键?