开发者

Actionscript: how to add a link text to text area

I have a text area displaying something, I want to achieve:

some words are rendered as hyperlink in html(blue color with underline), and when mouse hovers there it becomes a hand. When user clicks it, it will invoke a function in AS and pass the words to the callback function.开发者_运维百科

Is it doable?

Thanks.


You can do this with a Text Area by setting its "htmlText" property, rather than "text".

<mx:Script>
    <![CDATA[
        [Bindable] private var content:String = "<a href='http://www.google.com'>Click for Google</a>";
    ]]>
</mx:Script>

<mx:TextArea id="htmlDisplay" htmlText="{content}" />

You can use other tags to format the link however you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜