1 Reply Latest reply on May 30, 2010 10:59 PM by BhaskerChari

    Using htmlText to display Hyperlinks in Flex

    kiran7881 Level 1

      I have seen some examples where the Author used htmlText to display HyperLink on to the screens , but when i tried to use the same it actually gave me an Error .

      I am using Flex3

      Please tell me how to show Hyperlinks in Flex Screen .

      Thanks in advance .

        • 1. Re: Using htmlText to display Hyperlinks in Flex
          BhaskerChari Level 4

          Hi ,

           

          Check out the below code when you click "Navigate to Adobe.com" HyperLink it should redirect to adobe website.

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
              borderStyle="solid"
              backgroundGradientColors="[#FFFFFF, #FFFFFF]">
             
              <mx:Script>
                  <![CDATA[
                      import flash.events.TextEvent;


                      public function linkHandler(event:TextEvent):void {
                          myTA.text="The link was clicked.";
                         
                          // Open the link in a new browser window.
                          navigateToURL(new URLRequest(event.text), '_blank')
                      }
                  ]]>
              </mx:Script>
             
              <mx:Label selectable="true" link="linkHandler(event);">
                  <mx:htmlText>
                      <![CDATA[<u><a href='event:http://www.adobe.com'>Navigate to Adobe.com.</a><u>]]>
                  </mx:htmlText>
              </mx:Label>


              <mx:TextArea id="myTA"/>
          </mx:Application>

           

           

           

          If this post answers your question or helps, please kindly mark it as such.


          Thanks,

          Bhasker Chari