2 Replies Latest reply on Oct 14, 2008 10:19 AM by Gregory Lafrance

    problem in URLRequest

    san00001 Level 1
      Hi,

      I am creating dynamic links.The links and url's are comming from array.Here the link is opening in a new window by using _blank.To open it in same page i need to use _self.But i need to check if the current clicked label is "Mailto" then only the link should open in same window for all other links it should open in new window.Hw to achive this.pls help me to do this.My code is

      var linkName:Array = ["contactus", "feedback", "faq", "Mailto"];
      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.selectable = true;
      //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')
      }