AS3 では asfunction の代わりに TextEvent.LINK を使う


TextField の htmlText に target=”_blank” 付きでリンクを貼ると、IE でポップアップブロックされる。

ActionScript

textField.htmlText = "<a href='http://google.co.jp' target='_blank'>Google</a>";

なので、それを回避するため asfunction 経由の ExternalInterface を使おうと思ったら、AS3 には asfunction は無い。で、代わりに TextField のイベント TextEvent.LINK を使う。

ActionScript

textField.htmlText = "<a href='event:http://google.co.jp'>Google</a>";
textField.addEventListener(TextEvent.LINK, function(event:TextEvent):void {
ExternalInterface.call("window.open", event.text);
});
カテゴリー: Flash   パーマリンク

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>