You only need to call the global function geturl () to open any website in and before corner 2. In ActionScript 3, the global function geturl () has been canceled and replacedFlash.netFunctions in the packageNavigatetoURL ()The API format is as follows:
Public Function navigatetoURL (request: URLRequest, window: String = NULL): void
If you want to close the browser window in the flex application, you can use navigatetoURL to call Javascript. The following is an example for online search:
Reference
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute">
<Mx: SCRIPT>
<! [CDATA [
Private function closeie (): void {
VaR request: URLRequest = new URLRequest ("javascript: window. Close ()");
NavigatetoURL (request, "_ Self ");
}
]>
</MX: SCRIPT>
<Mx: button textalign = "center" label = "close current IE" Click = "closeie ()"/>
</MX: Application>
After testing, you will find that a confirmation message is displayed before the window is closed. If you want to close the window and do not bring up the information window, you can simply change the above Code (change the line for the request variable declaration, pay attention to the black part.
Reference
VaR request: URLRequest = new URLRequest ("javascript:Window. Opener = NULL;Window. Close ()");
It can be simpler, as shown below:
Reference
<? XML version = "1.0" encoding = "UTF-8"?>
<Mx: Application xmlns: MX = "http://www.adobe.com/2006/mxml" layout = "absolute">
<Mx: button textalign = "center" label = "close current IE" Click = "navigatetoURL (New URLRequest ('javascript:Window. Opener = NULL;Window. Close () '),' _ Self ') "/>
</MX: Application>