3 Replies Latest reply on Nov 2, 2011 12:10 AM by Kumar Pratik

    Link event in flex text control

    Kumar Pratik Level 1

      Hi All,

       

      I am using a flex text control which has link in between. Value of text is coming from database. I have the following code:

       

      <mx:Text id="lbl"

                                                                              selectable="true"

                                                                              initialize="lbl_initialize();"

                                                                              link="lbl_link(event);" />

       

                                                                             <mx:Script>

                                                                          <![CDATA[

                                                                              import mx.controls.Alert;

       

                                                                              private function lbl_initialize():void {

                                                     

                                                      

                                                                                 lbl.htmlText="<a href='event:flex.org'>{data.uname}</a> is Pratik";            

                                                                              }

                                                                              private function lbl_link(evt:TextEvent):void {

                                                                                  Alert.show(evt.toString(), evt.text);

       

                                                                                  switch (evt.text) {

                                                                                      case "flex.org":

                                                                                          // You clicked the flex.org link.

                                                                                          break;

                                                                                  }

                                                                              }

                                                                          ]]>

                                                                      </mx:Script>

       

       

      The problem here is the value which i want to poulate is not displaying and it is getting displayed as {data.uname}. Please let me know how can i achive this.

       

      Thanks