I have a Flex app that loads various modules. Sometimes when I load a new module I have some parameters appended to the URL and I don't want these parameters to display in the address bar. I extract the parameters when the module is loaded using the following code:
var url:String = this.loaderInfo.url; // discard everything up to, and including, the question mark (?) in the URL. var pattern:RegExp = /.*\?/; var urlStr:String = (url).replace(pattern, ""); //Use the URLVariables class to parse the query-string. var urlVars:URLVariables = new URLVariables(urlStr); // Now the parameters are accessible as objects label1.text = urlVars.FirstName; label2.text = urlVars.LastName; This works great until situations where there are no parameters. In some situations, I want to load a module and not have any parameters attached to the url. Just a basic url like: myModule.swf When the above code runs, it breaks at this line: var urlVars:URLVariables = new URLVariables(urlStr); This is the error message: Error #2101: The String passed to URLVariables.decode() must be a URL- encoded query string containing name/value pairs. How do I test to see if the url has any parameters appended to it before I make the call to UrlVariables.decode? Is there some built-in Flex method that can let you know if your url has parameters or not? Thanks

