flash弹出窗口总结 2008-09-30 18:37

字号:    
我们学习网页的,常常需要打开一个新的窗口,在flash中我们也要打开一个新的窗口,
我们打开的窗口多种多样,比如一个固定大少的,全屏的....
     在一段时间的动画互动设计工作中,将我常用到的弹出窗口代码提供给大家,如果对
您有帮助的话,就回下贴,如果您有更好的,不烦贴出来,让大家学习学习
  首先我们要了解弹出新窗口的函数及它的属性,具体总结的各个属性参数如下:
window = object.open([URL ][, name ][, features ][, replace]]]])
URL:新窗口的URL地址
name:新窗口的名称,可以为空
featurse:属性控制字符串,在此控制窗口的各种属性,属性之间以逗号隔开。
fullscreen= { yes/no/1/0 } 是否全屏,默认no
channelmode= { yes/no/1/0 } 是否显示频道栏,默认no
toolbar= { yes/no/1/0 } 是否显示工具条,默认no
location= { yes/no/1/0 } 是否显示地址栏,默认no
directories = { yes/no/1/0 } 是否显示转向按钮,默认no
status= { yes/no/1/0 } 是否显示窗口状态条,默认no
menubar= { yes/no/1/0 } 是否显示菜单,默认no
scrollbars= { yes/no/1/0 } 是否显示滚动条,默认yes
resizable= { yes/no/1/0 } 是否窗口可调整大小,默认no
width=number 窗口宽度(像素单位)
height=number 窗口高度(像素单位)
top=number 窗口离屏幕顶部距离(像素单位)
left=number 窗口离屏幕左边距离(像素单位)



常用的弹出窗口的代码:
//弹出固定窗口
<script>function appointfile(file){
window.open(file, "", "height=400, width=600, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")
}</script>


//弹出居中窗口
   <script> function center(page, width, height) {
        OpenWin = this.open(page, "webstudio", "toolbar=no, menubar=no ,location=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\"");
    }
</script>


//弹出全屏窗口
<script>function openFullScreen(page) {
              var URLen=page;
              var windowNamen="mainflashwindow";
              var browserName=navigator.appName;
              var operatingSystem=navigator.platform;
              var version = parseFloat(navigator.appVersion);
              if (browserName.indexOf("Netscape")!=-1 && version>=4.0 && operatingSystem.indexOf("Mac")!=-1)
               {
               window.open(URLen,windowNamen,'titlebar=no,top=0,left=0,width=' + window.screen.availWidth+',height='+window.screen.availWidth+',screenX=0,screenY=0,top=0,left=0')
               }
              else if (browserName.indexOf("Microsoft Internet Explorer")!=-1 && operatingSystem.indexOf("Mac")!=-1)
               {
               window.open(URLen,windowNamen,'titlebar=no,top=0,left=0,width=' + window.screen.availWidth+',height='+window.screen.availWidth+',screenX=0,screenY=0,top=0,left=0')
               }
              else if (browserName.indexOf("Netscape")!=-1 && operatingSystem.indexOf("Mac")!=-1)
               {
               window.open(URLen,windowNamen,'width='+screen.width+',height='+screen.height+',top=0,left=0');
               }
              else if (browserName.indexOf("Microsoft Internet Explorer")!=-1 && operatingSystem.indexOf("Win")!=-1)
               {
               //是否是完全全屏的开关.放开下面的一行,则完全全屏,注掉下面一行则打开带有标题条的全屏
                              //window.open(URLen,windowNamen,'fullscreen=yes')
              var win = window.open(URLen,windowNamen,'titlebar=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,top=0,left=0,width=' + window.screen.availWidth+',height='+window.screen.availHeight+',screenX=0,screenY=0,top=0,left=0')
                     win.resizeTo(screen.width, screen.height);
                      //win.moveTo(1, 1);
                      //win.moveTo(0, 0);
                      //win.resizeTo(screen.width, screen.height);
               }              
              else if (browserName.indexOf("Netscape")!=-1 && operatingSystem.indexOf("Win")!=-1)
               {
               window.open(URLen,windowNamen,'width='+screen.width+',height='+screen.height+',top=0,left=0');
               }
              else
               {
               window.open(URLen,windowNamen);
               }
       }
</script>

在flash中我们只要使用getURL("javascript:functionname(parameter1,parameter2...)就OK了!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
网易公司版权所有 ©1997-2009