動的テキストフィールドから as3 関数を呼び出そうとしています。
私はこれを試しました:
function showPopupWindow(){
trace("it works");
}
var texts="Hello world. <a href='#' onclick='showPopupWindow()'><u>This is a function call</u></a>";
text_txt.htmlText = texts;
動的テキストフィールドから as3 関数を呼び出そうとしています。
私はこれを試しました:
function showPopupWindow(){
trace("it works");
}
var texts="Hello world. <a href='#' onclick='showPopupWindow()'><u>This is a function call</u></a>";
text_txt.htmlText = texts;
TextEvent.LINK
イベントを使用する必要があります。最初に、名前の先頭に追加することで Flash が認識できる URL を指すリンクを作成する必要がありますevent:
。たとえば、次のようなテキストがあるとします。
textField.htmlText = "<a href='event:playMovie'>Play.</a><br />" +
"<a href='event:stopMovie'>Stop.</a>";
次に、イベントのリスナーを追加する必要があります。プロパティを使用して、TextEvent::text
クリックされたリンクを特定できます。上記のコードを使用したサンプル ハンドラーは次のとおりです。
textField.addEventListener(TextEvent.LINK, handleLink);
function handleLink(evt:TextEvent):void {
switch (evt.text) {
case "playMovie":
play();
break;
case "stopMovie":
stop();
break;
}
}