求助:因为层里面包含flv文件,要关闭的时候,用隐藏层,播放的flv视频在层隐藏时,仍有视频的声音存在,请问如何才能彻底关闭层,也就是在关闭层时同时关闭视频,
希望高手帮帮忙啊!
希望高手帮帮忙啊!
解决方案 »
- 求1个特效 谢谢大神了
- 网站第一次打开图片播放处错位
- jQuery问题,请问如何用jQuery清除<table>表单中的所有行。
- 模式窗口刷新问题 很急
- *************************************js的prototype加载顺序????小弟的发现
- 如何实现接受数据自动提交?
- 请教,能不能用js实现一个进度条同时控制两个视频文件,在拖动时使两个视频文件同步
- js,如何多次控制选中单选按钮
- ▲▲▲ <textarea></textarea>的内容中,如何插入"</textarea>"?
- 一直困扰着我的JavaScript问题,请DX帮忙!
- 急急急急
- 请教一下PHP老手
MD就有STOP函数来停止影片的播放。隐藏同时停止播放就OK了,否则你就要卡率小小内存用户在页面停留过长操作过多而引起的内存开销问题了
如果把div销毁了,又想打开播放器呢,又得再次创建
//停止播放器播放的as脚本
}
//注册事件提供给外部js调用,具体意义自己查找这个函数
flash.external.ExternalInterface.addCallback("forJSStop", null, stopPlay);js调用//swfId:为你object,embed对象的id和name
function stop(){ //js调用flash中注册的方法,
if(window["swfId"]&&window["swfId"].forJSStop)window["swfId"].forJSStop();//ie
else if(Showbo.$("swfId").forJSStop)Showbo.$("swfId").forJSStop();
else if(document["swfId"]&&document["swfId"].forJSStop)document["swfId"].forJSStop();//ff
}
flv文件应该是在FLASH里播放的 这个FLASH应该提供了 JS的控制方法 比如关闭 开始等方法
LZ向这个方向去查找
是要修改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){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"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(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},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[_16.length]=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");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_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");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_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{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}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(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?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(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;麻烦帮我看一下,这里面需要修改吗?谢谢你啊!!!我看了这么多热心朋友的回答,虽然有点思路,但问题是,我不知道从何下手,也许这对你们来说,真的很简单,可我偏偏就不会,也不懂,所以还得请你们帮帮忙啊~~~~~ 谢谢了!
至于删除:div.innerHTML="" 这样呢
//视频
</div>script:
document.getElementById("flv").innerHTML="";
document.getElementById("flv").style.display="none";
<div align="center">
<div id="Layer1">
<table width="700" border="1" cellpadding="0" cellspacing="0" bordercolor="#808080">
<tr>
<td><table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="right"><img src="searchb7.gif" width="30" height="30" style="cursor:hand" onclick="MM_showHideLayers('container','','hide')" /></div></td>
</tr>
</table>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="380"><div align="left"><span class="STYLE1"> </span></div></td>
<td width="380"><div align="left"></div></td>
<td width="40"><div align="right"></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="380"><div align="left"><span class="STYLE2"> </span></div></td>
<td width="380"><div align="center"></div></td>
<td width="40"> </td>
</tr>
</table>
<table width="550" height="350" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div id="container"><a href="http://www.macromedia.com/go/getflashplayer"></div>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var s1 = new SWFObject("player.swf","ply","628","400","9","#FFFFFF");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","file=video_2.flv");
s1.write("container");
</script>
</td>
</tr>
</table>
<table width="550" height="26" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="STYLE1"><div align="center"> </div></td>
</tr>
</table>
<div align="right"></div></td>
</tr>
</table>
</div>
</div>
<p align="center"> </p>
</body>
</html>我没发现你上传的页面中有MM_showHideLayers这个方法,我加了一个进去,把下面的代码加入到页面最底部<script type="text/javascript">
function MM_showHideLayers() { //v3.0
var i, p, v, obj, args = MM_showHideLayers.arguments;
for (i = 0; i < (args.length - 2); i += 3) if ((obj = MM_findObj(args[i])) != null) {
v = args[i + 2];
if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v = 'hide') ? 'hidden' : v; }
obj.visibility = v;
} document.getElementById("container").removeChild(document.getElementById("ply"));
} function MM_findObj(n, d) { //v4.01
var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
}
if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
if (!x && d.getElementById) x = d.getElementById(n); return x;
}
</script>
这样子以后,点击右上角的X就可以把音乐停止掉了
document.getElementById("container").removeChild(document.getElementById("ply"));
document.getElementById("container")这个是你的层
document.getElementById("ply")这个就是你的播放器。
因为你的代码中创建播放器的时候是
var s1 = new SWFObject("player.swf","ply","628","400","9","#FFFFFF");
第二个参数决定了这个播放器的ID就是ply