Flex打开新窗口 Flex调Javascript打开新窗口代码实例
人气:0想了解Flex调Javascript打开新窗口代码实例的相关内容吗,在本文为您仔细讲解Flex打开新窗口的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Flex,打开新窗口,下面大家一起来学习吧。
测试应用TestJavascript.mxml 复制代码 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
<![CDATA[
private function openWindow(pageUrl:String,pageName:String):void{
var jsString:String="";
jsString+=" var screenWidth = screen.availWidth, screenHeight = screen.availHeight;";
jsString+=" var args = 'toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no';";
//打开全屏的新窗口
jsString+=" var win = window.open('"+pageUrl+"','"+pageName+"',args);";
jsString+=" if(win){";
jsString+=" win.resizeTo(screenWidth,screenHeight);";
jsString+=" win.outerWidth = screenWidth;";
jsString+=" win.outerHeight = screenHeight;";
jsString+=" win.moveTo(0,0);";
jsString+=" }";
ExternalInterface.call("function(){"+jsString+"}");
}
protected function openButton_clickHandler(event:MouseEvent):void
{
openWindow("http://www.baidu.com","百度");
}
]]>
</fx:Script>
<s:Button id="openButton" label="打开百度" click="openButton_clickHandler(event)"/>
</s:Application>
加载全部内容