Flex:如何从htmlText锚点调用actionscript函数

Tol*_*rak 3 apache-flex textarea actionscript-3 htmltext

有没有办法从TextArea组件的htmlText属性中定义的锚调用动作脚本函数.

谢谢

aku*_*ser 5

如果此锚是标记的href,您可以调度事件并按如下方式处理它们:

<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)" />  
Run Code Online (Sandbox Code Playgroud)