开发者

Actionscript: how to add a link text to text area

开发者 https://www.devze.com 2023-01-16 17:09 出处:网络
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

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

精彩评论

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