FLEX文本htmlText调用js函数或者发送flex事件

来源:互联网 发布:湖南卫视网络直播平台 编辑:程序博客网 时间:2024/06/06 02:02

包含两种情况 

1、js侦听

txt.htmlText = "<a href='javascript:textOnclick();'>内容</a>";

textOnclick为包含当前swf所在的页面上的js函数

2、flex监听

txt.htmlText = "<a href='event:click'>con</a>"; 
txt.addEventListener(TextEvent.LINK,linkhandle);

function linkhandle(textEvt:TextEvent):void{
    trace(textEvt.type);   //link

    trace(textEvt.text);   //click

    trace(textEvt.target.text) ;   //con
}

0 0