AS3 Quirk: navigateToURL + POST
I was experiencing a strange error: when using code similar to Adobe’s example shown below, the URL Request was performing a GET behavior instead of a POST. This only seemed to occur in Adobe’s test environment (e.g. Control > Test Movie). It works fine on an actual web server.
package {
import flash.display.Sprite;
import flash.net.navigateToURL;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class URLRequest_method extends Sprite {
public function URLRequest_method() {
var url:String = "http://www.[yourDomain].com/application.jsp";
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.exampleSessionId = new Date().getTime();
variables.exampleUserLabel = "guest";
request.data = variables;
request.method = URLRequestMethod.POST;
navigateToURL(request);
}
}
}
0 Comments:
Posta un commento
<< Home