I really don’t understand why this won’t work? I’ve made a test which sends some POST data to a script on my page which works fine. But why does not this work?
var mapsize = _cmap.fieldx.toString(16) + _cmap.fieldy.toString(16);
var names = "Zomis_AI6";
var description = "descr";
var result = "gameresult";
var upldata: String = "mapsize="+mapsize+"&names="+names+"&description="+description+"&result="+result;
trace(upldata);
var variables:URLVariables = new URLVariables(upldata);
var request2:URLRequest = new URLRequest();
request2.url = "http://www.zomis.net/record.php";
request2.method = URLRequestMethod.POST;
request2.data = variables;
var loader2:URLLoader = new URLLoader();
loader2.dataFormat = URLLoaderDataFormat.VARIABLES;
loader2.addEventListener(Event.COMPLETE, uploadcomplete);
try {
loader2.load(request2);
trace("Loaded");
}
catch (error:Error) {
trace("Unable to load URL");
}
Tracing gets:
mapsize=1010&names=Zomis_AI6&description=descr&result=gameresult
Loaded
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables$iinit()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()