Question

I need to send a query string from Flash so that it appears in address bar of a browser. Basically, I need to make a Flash version of this HTML code:

<a href="Portfolio.htm?image=4">link</a>

Seems simple... When I try to do this from Flash the browser cuts off the query string. So instead of getting Portfolio.htm?image=4, I only get Portfolio.htm This is the actionscript I am using:

var url:String = "Portfolio.htm";
var variables:URLVariables = new URLVariables();
variables.image = '4';
var newRequest:URLRequest = new URLRequest(url);
newRequest.data = variables;
newRequest.method = URLRequestMethod.POST;
navigateToURL(newRequest);

This actionscript works great when I click the button from the Flash player. It stops working when I try to put the swf into a HTML wrapper.

The query string image=4 is not going to PHP file. Portfolio.htm uses Javascript to strip the variable from the URL. Most of the questions surrounding this topic deal with PHP files and don't care if the query string appears in the browser address bar.

Was it helpful?

Solution

Try changing the URLRequestMethod to GET instead of POST.

newRequest.method = URLRequestMethod.GET;

Or simply leave it out because GET is the default method.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top