加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

关于flash使用的一些方法

发布时间:2020-12-15 06:51:24 所属栏目:百科 来源:网络整理
导读:? 1、让html页面中插入的flash在IE和FireFox都可以显示 IE和Firefox都兼容 object id="flash1" data="Flash-VII.swf" type="application/x-shockwave-flash" width="100%" height="100%" param name="movie" value="Flash-VII.swf" / param name="wmode" val

?

1、让html页面中插入的flash在IE和FireFox都可以显示

IE和Firefox都兼容

 <object id="flash1" data="Flash-VII.swf" type="application/x-shockwave-flash" width="100%" height="100%">
        <param name="movie" value="Flash-VII.swf" />
        <param name="wmode" value="transparent"/>
        </object>



?2、flash onclick

在object上添加onclick事件是不会生效的,只能另辟蹊径:

<span onmousedown="gotoDetaultPage()" style="cursor: hand;" title="click to skip this movie / 点击跳过动画">
        <object id="flash1" data="Flash-VII.swf" type="application/x-shockwave-flash" width="100%" height="100%">
        <param name="movie" value="Flash-VII.swf" />
        <param name="wmode" value="transparent"/>
        </object>
    </span>


?

3、判断flash 播放完毕

<html>
<head>
    <title>test page</title>
    <script>
			function gotoDetaultPage(){				
				location.href='default2.html';
			}
			
			function getFlashMovieObject(movieName) {  
				if (window.document[movieName]){       
				    return window.document[movieName];   
				}
				if (navigator.appName.indexOf("Microsoft Internet")==-1){
                    if (document.embeds && document.embeds[movieName]){
                        return document.embeds[movieName];   
                    }
                }else{ //if (navigator.appName.indexOf("Microsoft Internet")!=-1){ 
                    return document.getElementById(movieName);   
                } 
		    }
						
			window.onload=function(){
				//alert('start');
				setInterval("checkOver()",500);
			}
			
			var globalCurrent = 0;
			var lastCurrent = 0;
			function checkOver(){				
				var movie = getFlashMovieObject("flash1");					
				//alert(movie.TotalFrames);				
				var currentF = movie.CurrentFrame();
				
				globalCurrent += Math.abs(currentF - lastCurrent);
				lastCurrent = currentF;
				
				var totalF = 0;
				if (navigator.appName.indexOf("Microsoft Internet")==-1){
					totalF = movie.TotalFrames();
				}else{
					totalF = movie.TotalFrames;
				}				
				
				if(totalF < globalCurrent){					
					gotoDetaultPage();					
					if(movie.stopplay != 'undefined' && movie.stopplay != null)
						movie.stopplay();
				}
			}
			
    </script>

</head>
<body style="margin: 0;">		
    <span onmousedown="gotoDetaultPage()" style="cursor: hand;" title="click to skip this movie / 点击跳过动画">    	
        <object id="flash1" data="flash.swf" type="application/x-shockwave-flash" width="100%" height="100%">
		<param name="movie" value="flash.swf" />
		<param name="wmode" value="transparent"/>
		</object>
    </span>
</body>
</html>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读