Flex調(diào)Javascript打開新窗口示例代碼
更新時(shí)間:2013年08月06日 16:17:11 作者:
Flex通過調(diào)用Javascript打開全屏的新窗口新窗口示例代碼 ,具體實(shí)現(xiàn)代碼如下,感興趣的朋友可以參考下,希望對大家有所幫助
測試應(yīng)用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>
復(fù)制代碼 代碼如下:
<?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>

您可能感興趣的文章:
- JS打開新窗口的2種方式
- js打開新窗口方法整理
- JS打開新窗口防止被瀏覽器阻止的方法
- javascript打開新窗口同時(shí)關(guān)閉舊窗口
- 打開新窗口關(guān)閉當(dāng)前頁面不彈出關(guān)閉提示js代碼
- JS關(guān)閉窗口與JS關(guān)閉頁面的幾種方法小結(jié)
- JavaScript無提示關(guān)閉窗口(兼容IE/Firefox/Chrome)
- IE JS無提示關(guān)閉窗口不提示的方法
- JavaScript實(shí)現(xiàn)自動彈出窗口并自動關(guān)閉窗口的方法
- JS關(guān)閉窗口或JS關(guān)閉頁面的幾種代碼分享
- JS關(guān)閉窗口時(shí)產(chǎn)生的事件及用法示例
- JavaScript實(shí)現(xiàn)單擊網(wǎng)頁任意位置打開新窗口與關(guān)閉窗口的方法
相關(guān)文章
Flex父子窗口相互調(diào)用實(shí)現(xiàn)思路及源碼
這篇文章主要介紹了Flex父子窗口相互調(diào)用實(shí)現(xiàn)思路及源碼,需要的朋友可以參考下2014-05-05Flex動態(tài)生成可編輯的DataGrid具體實(shí)現(xiàn)代碼
DataGrid具有以下功能:表頭是動態(tài)生成的、每行都是有序號的、每行都是可以編輯、插入、刪除、修改,接下來為大家分享下Flex如何動態(tài)生成可編輯的DataGrid2013-04-04Flex Label控件豎排顯示文字的實(shí)現(xiàn)代碼
Label控件豎排顯示文字一般都是橫排的,接下來為大家分享個(gè)方法讓它變成豎排,感興趣的童鞋們可以學(xué)習(xí)下,希望對你有所幫助2013-04-04Flex中實(shí)現(xiàn)對一個(gè)text渲染不同的字體顏色示例
本文為大家詳細(xì)介紹下Flex中如何實(shí)現(xiàn)對一個(gè)text渲染不同的字體顏色,具體的實(shí)現(xiàn)思路及代碼如下,有興趣的朋友可以參考下哈,希望對大家有所幫助2013-07-07flex chrome瀏覽器調(diào)試出現(xiàn)空白的解決方法
flex瀏覽器調(diào)試出現(xiàn)空白,原因是谷歌有個(gè)默認(rèn)的flash播放器,只要將默認(rèn)的播放器禁用,留下新安裝的插件,就OK了2014-02-02flex導(dǎo)出excel具體實(shí)現(xiàn)
flex導(dǎo)出excel的前提是需要插件as3xls-1.0.1.swc,下面為大家介紹下具體的實(shí)現(xiàn)2014-01-01