有什么方法可以从 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/