10-03-2007, 01:53 PM
|
#1
|
|
|
String passed to URLVariables.decode() must be a URL-encoded query string...
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?
Code:
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:
Code:
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()
|
|
|
10-03-2007, 06:03 PM
|
#2
|
|
|
I found the solution!
I thought that the error message was because of the variables passed to the php page, but it's actually about everything that is received from PHP. Changing in the code to:
Code:
loader2.dataFormat = URLLoaderDataFormat.TEXT;
Solved the problems 
|
|
|
09-02-2009, 02:44 PM
|
#4
|
|
|
Quote:
Originally Posted by Zomis
I found the solution!
I thought that the error message was because of the variables passed to the php page, but it's actually about everything that is received from PHP. Changing in the code to:
Code:
loader2.dataFormat = URLLoaderDataFormat.TEXT;
Solved the problems 
|
Thanks mine too 
|
|
|
01-07-2010, 04:15 PM
|
#7
|
|
|
Thanks!
Nice, mine too. I was debugging a while under the same impression, that sending to PHP was the issue...
It's a common erorr... Mainly b/c it's a bit misleading with the whole concept of "sendAndLoad" from AS2 coming over into the stricter OOP AS3 style- the ".dataFormat" property of the URLLoader class used in this context doesn't clue you in if the "data" you're setting the format for is going out or coming in... I mean, it is a URLLoader not URLSender class, but in many cases this is being used to send to PHP in the AS2 "SendAndLoad" fashion, and the load portion is just the response from the sever side script...
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 04:40 PM.
|
|