I have one swf replacing another. The first SWF doesnt load the second one into its display list, is uses navigateToUrl (_self) to open the new swf instead of itself ( in the same window). I
d like the first SWF that calls the second SWF to pass to it a single variable, based on the choise of the surfer ( meaning it is dynamic). What would be the best way of doing that with AS3 ?
Basically what I did try was to pass this var to the query string of the new SWF. I succsedeed doing that, but I fail retrieving it from the query string within the new SWF. This is the code I used to pass the var :
this.addEventListener(MouseEvent.CLICK, onClick);
function onClick(myEvent:Event):void {
var req:URLRequest = new URLRequest("newPage.html");
var Variable:URLVariables = new URLVariables();
Variable.varA = "A";
req.data = Variable ;
req.method = URLRequestMethod.GET
navigateToURL(req, "_self");
}
The Url I get for the new swf, using this code is :
[COLOR=#ff9900]http://www.mySite.com/newPage.html?varA=A[/COLOR]
and the code I`ve tried using for retrieving this query string data in the new swf is :
myTextField.text = this.root.loaderInfo.parameters["varA"];}
or:
myTextField.text = this.root.loaderInfo.parameters.varA;}
or:
myTextField.text = root.loaderInfo.parameters["varA"];}
or:
myTextField.text = root.loaderInfo.parameters.varA;
But, it doesnt work.
If anyone has any idea whats wrong in this code or of another way of doing the whoe thing, I
d be very grateful.