Flex调Javascript打开新窗口示例代码

编程学习 2021-07-05 11:32www.dzhlxh.cn编程入门
Flex通过调用Javascript打开全屏的新窗口新窗口示例代码 ,具体实现代码如下,感兴趣的朋友可以参考下,希望对大家有所帮助
测试应用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>

Copyright © 2016-2025 www.dzhlxh.cn 金源码 版权所有 Power by

网站模板下载|网络推广|微博营销|seo优化|视频营销|网络营销|微信营销|网站建设|织梦模板|小程序模板