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.
精彩评论