You have to listen for the TextEvent.LINK event on the Text instance.

Try the following and debug the movie to see the trace output:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" creationComplete="initApp()">

<mx:Script>
<![CDATA[
  import flash.events.TextEvent;
  import flash.util.trace;

  [Bindable]
  private var _htmltext:String = "<p><a href=''>click me</a></p>"
  //
  private function initApp():void {
   _txt.addEventListener(TextEvent.LINK, textLinkHandler);
  }
  //
  private function textLinkHandler(evt:TextEvent):void {
   trace("Application ::: textLinkHandler");
   trace("    linkText: "+evt.text);
  }
]]>
</mx:Script>

<mx:Text id="_txt" width="300" height="200" htmlText="{_htmltext}"/>
</mx:Application>


regards,
Muzak

----- Original Message -----
From: "rigidcode" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, April 30, 2006 8:20 PM
Subject: [flexcoders] Re: Mutiline LinkButton? (Flex 2)


> --- In [email protected], "Manish Jethani"
> <[EMAIL PROTECTED]> wrote:
>>
>> On 4/30/06, rigidcode <[EMAIL PROTECTED]> wrote:
>>
>> Try grabbing the internal TextField object and setting its
>> word-wrapping on (I've lost track of how to do this myself).
>
> Yea I tried that but the "textField" of the LinkButton is always null.
>   Is that a bug in the Flex 2 API?  If so is there any way, at all,
> to do multiline hyperlinks in flex?
>
>
>> > Also, can I do hypertext in Flex?  Like, a text field with some of the
>> > words as hyperlinks?  And can I trap events when those links are
> clicked?
>>
>> Listen for the 'click' event and call 'navigateToURL' in the handler.
>
> If I have a < a href> style link in a Text object, how do I sink it's
> the "click" event?




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to