アンカーターゲットを変更するために見つけた例を書き直しました。リンクは同じウィンドウで開かれます。ただし、この方法には制限があります。静的リンクのみが修正され、リンクを新しいウィンドウで開こうとする JS メソッドはすべて失敗します。
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
initialize="init()">
<mx:Script>
<![CDATA[
private function init():void
{
html.htmlText =
"<html><body>" +
"<a href='http://adobe.com' target='_blank'>Adobe (blank)</a><br/>" +
"<a href='http://ixbt.com' target='_self'>iXBT (self)</a>" +
"</body></html>";
html.addEventListener(Event.COMPLETE, onHTMLComplete);
}
private function onHTMLComplete(event:Event):void
{
var document:Object = html.domWindow.document;
for each (var anchor:Object in document.getElementsByTagName("a"))
{
if (anchor.hasOwnProperty("target"))
{
if (anchor.target == "_blank")
{
anchor.target = "_self";
}
}
}
}
]]>
</mx:Script>
<mx:HTML id="html" width="100%" height="100%"/>
</mx:WindowedApplication>