« First collab with r... You're one of the t... »

[AS] Problems with myXML.load(url) and multiple GET vars.

Mar 21st, 2007

I was developing another little game, and I've been fighting with it for a couple of days, and after trying to locate the problem, seems like in the end it is just a limitation of the myXML.load() function.

A bit of detail about it:

I'm trying to send the scores to my .php at the same time I'm getting the updated list of scores in a XML format, something like:

myXML.load( "scores.php?action=submit_score &name=mr.doob &score=1000 &code=893493" );


So, the php will update the highscores table, and then It will give back the updated table in a XML format. However seems like this doesn't work. For some reason Flash doesn't ever do the call. I've debugged a lot this and this is what I've found:

myXML.load( "scores.php?action=submit_score" );
Works properly, Flash does the call, and it gets the XML back.

myXML.load( "scores.php?action=submit_score &name=mr.doob" );
Works properly, Flash does the call, and it gets the XML back.

myXML.load( "scores.php?action=submit_score &name=mr.doob &score=1000" );
Doesn't work!!

Seems like if you send more than 2 GET variables then flash won't do the call, and I know that it won't do the call because I've a logger on my php code that is saving all the calls that is getting on a .txt file.

Does anyone know if there is any workaround? I'll use a loadvars to send the scores and then get the XML again with a simple call.

#permalink

Share:
Digg! ~ del.icio.us ~ Stumble ~ Furl ~ Reddit
Its weird, I've never had that problem... Have you tried with the sendAndLoad method?
Anyway, you could use the ouput of a loadvars request to parse it as a XML... would be something like this:
php ouput:
&estado=ok&xml=blahblah&
flash:
miLV.onLoad = function() {
var xml= new XML();
xml.parseXML(miLV.xml);
}
Mar 21st, 2007
Cay
Ok, I think I've found the issue. And luckily, its my fault ;)

Something that I've to keep in mind from now on:
myXML.load("scores.php?a ction=submit_score&name=" +escape(playerName)+"&sco re="+escape(playerScore)) ;

And then in php:
$score = urldecode($_GET["score"]) ;

:S
Mar 21st, 2007
mr.doob
Webs / Print / Logos... everything I do will be listed here.



If you're looking for my Actionscript experiments, here you have: