Skip to Content »

FlashApe » Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs

 Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs

  • November 27th, 2007
  • 1:23 pm

I ran into this issue today trying to load some simple data from a php script. I was positive I was only sending name/value pairs and nothing else.  I had set the loader.dataFormat property to URLLoaderDataFormat.VARIABLES, and using Charles I can see that my data was arriving fine.

The solution in my case was simple:  I was adding a leading ‘&’ in the variables string, which URLLoader doesn’t appreciate. So instead of this, which was a habit picked up with AS 2:

echo "&result=success"

You just need to do:

echo "result=success"

You still need the ampersand to separate multiple name/value pairs though.

 

8 People had this to say...

Gravatar

yah… havin’ this error a month ago :) If you don’t know what it can drive you crazy. (happen to me:)

Gravatar
  • Maria
  • February 5th, 2008
  • 5:08 am

So you didn’t find a solution for AS 3? Because I kind of have the same problem…the data from the php file is loading, but I can’t read out the variables properly respectively I can’t read them out at all…instead I get the same error as above when starting my swf online…it’s kind of driving me crazy right now and I would really appreciate some help in this situation. unfortunately (or not) I’m using as 3.0 and I wanna stick with it solving this problem.

Maria

Gravatar
  • rich
  • February 5th, 2008
  • 11:45 am

That solution was for AS 3. Make sure you are not sending back your variables from php starting with a ‘&’ sign, and make sure you have myLoader.dataFormat = URLLoaderDataFormat.VARIABLES

Gravatar
  • Mariano
  • February 23rd, 2008
  • 1:01 pm

Yes! Thanks! it was very helpfull to me.

Gravatar
  • Mike
  • March 13th, 2008
  • 10:11 am

Thanks - that fixed my problem…

Gravatar
  • Omer
  • May 27th, 2008
  • 4:45 pm

thanks & thanks :)
i will get old early .. as3 makes me crazy :)

Gravatar
  • John
  • June 5th, 2008
  • 9:35 pm

Many thanks…..it worksss hahahah

Gravatar
  • Dave
  • June 17th, 2008
  • 1:13 pm

Thanks, very helpful. My situation was slightly different…

In my case the error was because the php page wasn’t returning anything at all, so I threw in an echo(”err=0″); to resolve it.

Want your say?

* Required fields. Your e-mail address will not be published on this site


You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>