Flex:浏览器弹出而不是Alert.show()类型的弹出



我试图创建一个浏览器弹出窗口与一些文本,而不是使用Alert.show()或Flash Player级别的弹出窗口。

我一直在寻找,并尝试了一些与URI数据方案的东西,但认为你们中的一个人可能做过类似的事情。

更新:

你可以使用Flex的externalInterface API来调用javascript函数。从而触发一个新的弹出对话框。

http://learn.adobe.com/wiki/display/Flex/External +接口http://www.quirksmode.org/js/popup.html

http://blog.flexexamples.com/2008/03/09/calling-javascript-functions-from-your-flex-applications-using-the-externalinterface-api/

更新:

var urlstr:String = "javascript:NewWindow=window.open('"+<any string> +"','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();void(0);");
    var url:URLRequest = new URLRequest(urlstr);

你想Flex窗口保持打开,只是弹出一个新的,对吗?从我的记忆中,这是不可能的Flash,因为它需要通过Javascript(窗口。打开),然而,你可以直接调用它使用ExternalInterface:

if (ExternalInterface.available) 
{
   ExternalInterface.call("window.open", "http://www.adobe.com", "win", "height=200,width=300,toolbar=no,scrollbars=yes");
}
至于url,你可以指定你自己的使用uri数据方案,它应该工作

下面的代码实现了这个功能:

<fx:Script>
    <![CDATA[
        import flash.net.navigateToURL;
        private function urlJump():void{
            var url:URLRequest = new URLRequest("javascript:NewWindow=window.open(''," +
                "'newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  " +
                "NewWindow.focus();void(0); " +
                "NewWindow.document.write('hello');");
            navigateToURL(url, "_self" );
        }           
    ]]>
</fx:Script>
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button click="urlJump()" />

最新更新