tags:

views:

12

answers:

1

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.

+1  A: 

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'&gt;Click for Google</a>";
    ]]>
</mx:Script>

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

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

bedwyr
Can I catch the event of user clicks the link? I want to hook the callback to the click event of hyperlink.
Bin Chen
Resolved by: http://stackoverflow.com/questions/871325/flex-how-to-call-an-actionscript-function-from-htmltext-anchor
Bin Chen