views:

42

answers:

1

In my application I tried using following codes to do this:

<mx:HTML x="0" y="0" width="100%" height="100%" location=“http://www.example.com”/&gt;

The page is loaded fine.But when I click the links I found sometimes there was no any response while I need a new explore window opened with the linking url.And also I tried:

<mx:Script>
<![CDATA[
private function init():void
{
 var req:URLRequest = new URLRequest("http://www.baidu.com");
  var a:HTMLLoader = new HTMLLoader();
  a.width = 400;
  a.height = 300;
  a.load(req);
  htmlmc.addChild(a);
}
]]>
</mx:Script>
<mx:HTML x="10" y="10" width="345" height="258" id="htmlmc"/>

But still got nothing.Any good ideas?

Thanks in advance!

+1  A: 

Hi, SpawnCxy

If your question is "how to open a link in new web browser window by click it in Adobe AIR?", please try this solution.

  1. Give "id" to your HTML component. (I give its "box" in this case.)
  2. Add this code to your application's creation complete handler.

Use following function:

protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
{
    box.htmlLoader.navigateInSystemBrowser = true;
}

Run your application and try to click on a link. This should work. I tested it with Adobe Flash Builder 4 on Windows 7. It works like a charm.

Teerasej
Nice solution.Thank you!
SpawnCxy