1 Reply Latest reply on Oct 13, 2008 1:48 AM by SujitG

    problem in creating dynamic links

    san00001
      Hi,
      Iam trying to create dynamic links on labels.The following is my code.I tried a lot,but link is not working.Someone pls help me to do this.

      var linkName:Array = ["contactus", "feedback", "faq", "help"];
      var linkURL:Array=["http:\\contactus.jsp","http:\\feedback.jsp","faq.jsp","he.jsp"];
      public function createmnu():void
      {
      var i:int = 0;

      for (i = 0; i < linkName.length; i++)
      {
      var label:Label;
      label = new Label();
      label.height = 15;
      label.htmlText =<a href='event:{linkURL }'>{linkName}</a>;
      //label.htmlText= "<a href='" + linkURL + "'>" + linkName + "</a>";
      //label.addEventListener(., links);
      label.addEventListener("link", linkHandler);
      label.setStyle("fontSize", "10");
      label.setStyle("color", "navy");
      hh.addChild(label);
      }
      }

      public function linkHandler(event:TextEvent):void
      {

      Alert.show("clicked");
      // Open the link in a new browser window.
      navigateToURL(new URLRequest(event.text), '_blank')
      }