apache-flex - 柔性 : How to call an actionscript function from htmlText anchor

标签 apache-flex actionscript-3 textarea htmltext

有什么方法可以从 TextArea 组件的 htmlText 属性中定义的 anchor 调用 ActionScript 函数。

谢谢

最佳答案

如果这个 anchor 是来自标签的 href,您可以分派(dispatch)事件并像这样处理它们:

<mx:Script>
    <![CDATA[
        private function linkHandler(e:TextEvent):void
        {
            if (e.text == "test")
                trace("test called")
        }
    ]]>
</mx:Script>
<mx:creationComplete>
    <![CDATA[
        textArea.htmlText="<a href='event:test'>Link!</a>";
    ]]>
</mx:creationComplete>

<mx:TextArea id="textArea" link="linkHandler(event)" />  

关于apache-flex - 柔性 : How to call an actionscript function from htmlText anchor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/871325/

相关文章:

javascript - 将文本区域链接到某物

jquery - 不要通过 jQuery.translator 翻译 textarea,怎么办?

android - 如何让 onActivityResult 在 Adob​​e Air 原生扩展中运行?

apache-flex - AdvancedDataGrid 不显示对象属性

css - FLEX - 是否可以将默认的表单项标签字体粗细从粗体改成正常?

android - Android 上的 AS3 Air - 加载 SWF 作为它自己的 Main()

javascript - 如何限制 chrome 中的最大文本区域宽度和高度或如何禁用文本区域调整大小

linux - 在 Linux 上使用 creationComplete 事件将函数注册为闪存回调失败

javascript - 如何使用 webpack 访问全局对象(窗口)?

actionscript-3 - 在 ActionScript Bytecode 中,NewActivation 是什么意思?