Steps聽to聽reproduce:
1.聽Create聽an聽application聽which聽loads聽a聽module.
2.聽Pass聽url-encoded聽variables聽along聽the聽query聽string聽while聽loading聽the聽module.聽For聽example:
[code]
<mx:ModuleLoader聽url="modules/modules/Module2.swf?name=jerry&flavor=chunky%20monkey"聽/>
[/code]
3.聽Try聽and聽get聽the聽"name"聽and聽"flavor"聽parameters聽from聽the聽loaded聽module.
Actual聽Results:
From聽within聽the聽module,聽the聽"this.loaderInfo.parameters"聽object聽is聽empty,聽even聽though聽you聽passed聽values聽along聽the聽query聽string.聽you聽can聽get聽the聽values,聽but聽it聽involves聽a聽weird聽mix聽of聽RegEx聽class,聽URLUtil聽or聽URLVariables聽classe,聽or聽writing聽all聽your聽own聽parsing聽logic.
Expected聽Results:
this.loaderInfo.parameters聽should聽parse聽the聽"url"聽variable聽for聽you聽and聽create聽all聽the聽variables.
Workaround聽(if聽any):
Parse聽the聽URL聽from聽within聽the聽module聽and聽use聽regular聽expressions聽to聽remove聽everything聽up聽to聽(and聽including)聽the聽question聽mark.聽Next,聽parse聽the聽url-encoded聽name/value聽pairs聽using聽the聽URLUtil聽class聽or聽the聽URLVariables聽class,聽like聽so:
[code]
private聽function聽init():void聽{
//聽discard聽everything聽up聽to,聽and聽including,聽the聽question聽mark聽(?)聽in聽the聽URL.
var聽re:RegExp聽=聽/.*\?/;
var聽urlStr:String聽=聽(this.loaderInfo.url).replace(re,聽"");
//聽Use聽the聽URLUtil.stringToObject()聽method聽to聽parse聽the聽query-string.
var聽str2:Object聽=聽URLUtil.stringToObject(urlStr,聽"&");
nameLbl.text聽=聽"name="聽+聽str2.name;
//聽Use聽the聽URLVariables聽class聽to聽parse聽the聽query-string.
var聽urlV:URLVariables聽=聽new聽URLVariables(urlStr);
flavorLbl.text聽+=聽"flavor="聽+聽urlV.flavor;
}
[/code]
The聽Flex聽documentation聽uses聽for聽loops聽and聽String.split()聽and聽rewrites聽most聽of聽the聽logic聽themselves,聽but聽that聽solution聽is聽a聽bit聽overkill聽considering聽the聽two聽solutions聽above聽work聽(and聽with聽a聽lot聽less聽code)聽

]]>