Flash全屏功能测试

Flash全屏功能测试
在线测试页面: http://www.klstudio.com/demo/as/fullscreen/fullscreen.html
相关资料文件: http://www.klstudio.com/demo/as/fullscreen/fullscreen.rar
<div id="flashcontent"></div>
<script language="javascript" src="js/swfobject.js"></script>
<script language="JavaScript">
   var orginFlash = {init:false,isFullScreen:false,position:"",top:"",left:"",width:"",height:""};
   function writeFlash(){
     var so = new SWFObject("fullscreen.swf", "fplayer", "100%", "100%", 8, "#FFFFFF");
     so.addParam("quality", "high");
     so.addParam("swLiveConnect", "true");
     so.addParam("menu", "false");
     so.addParam("allowScriptAccess", "sameDomain");
     so.addParam("allowFullScreen", "true");
     so.write("flashcontent");
   }
    function getScreenSize(){
      var w = 0;
      var h = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        w = window.innerWidth;
        h = window.innerHeight;
     } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
       w = document.documentElement.clientWidth;
       h = document.documentElement.clientHeight;
     } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
       w = document.body.clientWidth;
       h = document.body.clientHeight;
     }
     return {width:w,height:h};
   }
    function fullScreen(){
      if(!orginFlash.init){
        orginFlash.position = document.getElementById("flashcontent").style.position;
        orginFlash.top = document.getElementById("flashcontent").style.top;
        orginFlash.left = document.getElementById("flashcontent").style.left;
        orginFlash.width = document.getElementById("flashcontent").style.width;
        orginFlash.height = document.getElementById("flashcontent").style.height;
     }
     orginFlash.init = true;
     orginFlash.isFullScreen = true;
     var screenSize = getScreenSize();
     try{
       document.getElementById("flashcontent").style.position = "absolute";
       document.getElementById("flashcontent").style.top = "0px";
       document.getElementById("flashcontent").style.left = "0px";
       document.getElementById("flashcontent").style.width = screenSize.width +"px";
       document.getElementById("flashcontent").style.height = screenSize.height +"px";
       document.body.style.overflow="hidden";
       window.scrollTo(0,0);
     }catch(e){
     }
   }
   function normal(){
     if(orginFlash.init){
       orginFlash.isFullScreen = false;
       try{
         document.getElementById("flashcontent").style.position = orginFlash.position;
         document.getElementById("flashcontent").style.top = orginFlash.top;
         document.getElementById("flashcontent").style.left = orginFlash.left;
         document.getElementById("flashcontent").style.width = orginFlash.width;
         document.getElementById("flashcontent").style.height = orginFlash.height;
         document.body.style.overflow="auto";
       }catch(e){
       }
    }
   }
   function reSize(){
      if(orginFlash.isFullScreen){
         fullScreen();
      }
    }
   window.onresize = reSize;
   writeFlash();
</script>

P.S.
1、flash全屏功能代码部分参考网上资料。
2、flash全屏功能在IE6以上,flash player 7.0以上 浏览器环境中测试可以运行!
3、flash全屏功能通过两种方式实现,flash player版本号在9.0.18.60以上 是通过flash 9内部代码实现的,而低于这个版本的则是通过js + div来实现的!
4、通过flash 9新功能来实现全屏技术要注意以下几点:
      a、flash player版本必须是 9.0.18.60或更高版本;
      b、调用全屏功能代码需通过触发事件才可以运行的,如onPress,onRelease事件;
      c、在插入html 代码时需设置<param name="allowFullScreen" value="true" />;
      d、经多次研究发现,如 html代码设置成<param name="wmode" value="opaque" />或<param name="wmode" value="transparent" />时,则全屏功能无效!也就是说只有flash窗口模块设置为window时,全屏功能才有效(这个算是我的独家发现吧)!  

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值