关于flash使用的一些方法

 

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 οnmοusedοwn="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.οnlοad=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 οnmοusedοwn="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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值