*blog... kind of... *rss
[AS] Problems with myXML.load(url) and multiple GET vars.
2 commentsI 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.
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.
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?action=submit_score&name="+escape(playerName)+"&score="+escape(playerScore));
And then in php:
$score = urldecode($_GET["score"]);
:S
Something that I've to keep in mind from now on:
myXML.load("scores.php?action=submit_score&name="+escape(playerName)+"&score="+escape(playerScore));
And then in php:
$score = urldecode($_GET["score"]);
:S
*profile

traditional id: Ricardo Cabello Miguel
based in: London, UK
more: github, twitter, twitpic, soundcloud and flattr
*post nav
fiver2's new baby: debris
Mindcandy 2
Mr. Slip Up
So, what was in the box?
First collab with rtxcite: Bombardearte
[AS] Problems with myXML.load(url) and multiple GET vars.
You're one of the top UK creatives hand picked by Adobe
Adobe Apollo!! No thanks...
Useful? Not really... Fun? Absolutely!
In an office finally
AirPort Extreme Update 2007-002 doesn't let you use WPA
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=
flash:
miLV.onLoad = function() {
var xml= new XML();
xml.parseXML(miLV.xml);
}