Reputation: 83
I have a button on flex(AIR app). when i click on the button,has to open a browser window which will display an HTML page.
Upvotes: 1
Views: 886
Reputation: 15955
Create a URLRequest
to the web page, and open it with navigateToURL
:
var urlRequest:URLRequest = new URLRequest("http://www.adobe.com/");
navigateToURL(urlRequest);
Example loading a page upon click of a button with Flex 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">
<fx:Script>
<![CDATA[
import flash.net.navigateToURL;
protected function clickHandler(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://www.adobe.com"), "_blank");
}
]]>
</fx:Script>
<s:Button label="Open page"
click="clickHandler(event)" />
</s:Application>
Opens or replaces a window in the application that contains the Flash Player container (usually a browser). In Adobe AIR, the function opens a URL in the default system web browser.
Parameters
request:URLRequest
— A URLRequest object that specifies the URL to navigate to. For content running in Adobe AIR, when using the navigateToURL() function, the runtime treats a URLRequest that uses the POST method (one that has its method property set to URLRequestMethod.POST) as using the GET method.
window:String
(default = null) — The browser window or HTML frame in which to display the document indicated by the request parameter. You can enter the name of a specific window or use one of the following values:
- "_self" specifies the current frame in the current window.
- "_blank" specifies a new window.
- "_parent" specifies the parent of the current frame.
- "_top" specifies the top-level frame in the current window.
Creates a URLRequest object. If System.useCodePage is true, the request is encoded using the system code page, rather than Unicode. If System.useCodePage is false, the request is encoded using Unicode, rather than the system code page.
Parameters
url:String
(default = null) — The URL to be requested. You can set the URL later by using the url property.
Upvotes: 1