2 Replies Latest reply on May 8, 2007 12:40 PM by JabbyPandaUA

    TextEvent in HTML text not sent ?

    Karl_Sigiscar_1971 Level 3

      Hello,

      I have a problem with some HTML text within a Text component where some links are created using the <a href="event: syntax.

      I set up an event listener for the TextEvent, linkHandler but the event seems never to be triggered when I click on a link.

      Any clue ? Here is an excerpt of the code:

      <mx:Script>
      <![CDATA[

      import flash.net.*;
      import flash.text.TextField;
      import flash.events.TextEvent;

      private function init(event:Event):void
      {
      // Add an event handler (listener) to the HTML text
      tandctext.addEventListener(TextEvent.LINK, linkHandler);
      }

      public function linkHandler(linkEvent:TextEvent): void {
      switch(linkEvent.text) {
      case "tandc":
      navigateToURL(new URLRequest(" http://"), "_blank");
      break;
      case "limitations":
      navigateToURL(new URLRequest(" http://"), "_blank");
      }
      }

      ]]>
      </mx:Script>

      <mx:Text id="tandctext" styleName="termsAndConditions" x="10" y="37" width="331" height="50" color="black" fontStyle="plain" fontSize="10">
      <mx:htmlText>
      <![CDATA[This is a preview. As such, there are specific <a href="event:tandc">terms and conditions</a> as well as some <a href="event:limitations">limitations</a> that you need to be aware of.]]>
      </mx:htmlText>
      </mx:Text>

      Cheers,
      Karl.