有没有办法从TextArea组件的htmlText属性中定义的锚调用动作脚本函数。
谢谢
答案 0 :(得分: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)" />
答案 1 :(得分:1)
我得到了答案here ..
答案 2 :(得分:0)
ExternalInterface类将为您提供Javascript和Actionscript之间的通信通道。使用此类,您可以从页面的Javascript中侦听调用,以及调度消息和数据。
以下链接引用AS 3.0。希望有所帮助!