Go Back   kirupaForum > Flash > ActionScript 3.0

Reply
 
Thread Tools Display Modes
Old 10-03-2007, 01:53 PM   #1
Zomis
Registered User
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()
Zomis is offline   Reply With Quote

Sponsored Links (Guests Only) - Register | Need Help?
 

Old 10-03-2007, 06:03 PM   #2
Zomis
Registered User
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
Zomis is offline   Reply With Quote
Old 07-22-2009, 01:06 PM   #3
dandare
Registered User
this is such stupid bug! I spend lots of time till I found http://www.actionscript.org/forums/s....php3?t=196454
In other words URLLoaderDataFormat.VARIABLES renders as "variables", not "VARIABLES"

... adobe do something!!!!
dandare is offline   Reply With Quote
Old 09-02-2009, 02:44 PM   #4
Digitalosophy
Rockin' Out
 
Digitalosophy's Avatar
Location Elizbeth, NJ

Posts 8,614
Quote:
Originally Posted by Zomis View Post
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
Digitalosophy is offline   Reply With Quote
Old 09-02-2009, 03:58 PM   #5
wvxvw
Holosuite User
Please vote for this issue if you don't want to see that error again
http://bugs.adobe.com/jira/browse/FP-1666

__________________

I support FlashDevelop (the .NET open source editor for Flash and web developers)
couchsurfing if you need it
wvxvw is offline   Reply With Quote
Old 09-03-2009, 03:44 PM   #6
Digitalosophy
Rockin' Out
 
Digitalosophy's Avatar
Location Elizbeth, NJ

Posts 8,614
^ Voted
Digitalosophy is offline   Reply With Quote
Old 01-07-2010, 04:15 PM   #7
snowboardfoo
Registered User
Location San Diego, CA

Posts 17
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...
snowboardfoo is offline   Reply With Quote
Old 01-14-2010, 10:42 PM   #8
viaria
Registered User
this solved mine to, thanks.. but i need help something similer too, i am receiving data from php file
like this:
if(mail(bla bla)){
$sendresult= "success"
} else {
$sendresult= "failed"
}

how do i get that variable ($sendresult) from actionscript,

i have an event to know php file loaded, but i need to learn if mail sent,
i hope i didn't mess up, thanks..
viaria is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:40 PM.

SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
Creative web apps. Make your own free flash banners and photo slideshows.
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.

Flash Transition Effects

Flash Effect Tutorials

Digicrafts Components
Flash effects. Art without coding. Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Streamsolutions Content Delivery Networks Flipping Book - page flip flash component.
Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery Learn how to advertise on kirupa.com
 

cdn
content delivery network (cdn)

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Copyright 2010 - kirupa.com Copyright 2010 - kirupa.com