URLRequest help

so IM trying to take input text, and apply it to a URL string.
Im using URLRequest, and this is not kiking back an error,
but its also not including the zip either??

var zip:String;
var norcalhonda:URLRequest = new URLRequest(“http://www.norcalhonda.com/result.php?searchzip=” + zip);

goBtn.addEventListener(MouseEvent.CLICK , getCode);

function getCode(event:MouseEvent):void
{
zip = zipInput.text;
navigateToURL(norcalhonda);
//trace(zip);
}

The string concatenation occurs when the URLRequest is constructed. At the time, zip is null. You should create the URLRequest inside of getCode.

you coult try forming the URLRequest first.

IE -


var strRequest:String = "http://www.norcalhonda.com/result.php?searchzip=" + zip;
 
var norcalhonda:URLRequest = new URLRequest(strRequest);

However, I doubt you will see any difference, ultimately it’s doing the same thing.

Worth a try though :wink:

-------------------------------------edit below
Ahh, Krilnon is correct, good call.

thank you krilnon, I loosely came to taht conclusion when I changed set the variable to a real zip code, I knew it wasnt picking it up and hadnt calculated it yet, but I didnt think you could put a URLRequest Variable in a function, makes a lot of sense! thanks man!