10 Replies Latest reply on Jul 27, 2007 5:27 PM by kglad

    How to pass text field contents to URLRequest instance?

    ljcroker
      AS 2.0 provided a simple way to allow for input fields to pass urls to a browser, as well as passing variable values to scripts on the web (such as Google).

      I'm now struggling with getting an instance of the URLRequest object to use the contents of a text field for the string expected in the new URLRequest("stringhere.html")

      Here's some code that doesn't work. I have a button named submit_btn, and an input textfield named addressField_txt:

      var myAddress:String = addressField_txt.text;
      var myURL:URLRequest = new URLRequest (myAddress);
      function submitButton(myevent:MouseEvent):void {
      navigateToURL(myURL, "_blank");
      }

      submit_btn.addEventListener(MouseEvent.CLICK, submitButton);

      Any help would be appreciated!

      Thanks,
      Joyce