PDA

View Full Version : data Flash to PHP reloads the page !!


guille.soft
05-17-2006, 03:13 PM
Hi,
I have already sent a post earlier about that problem and I thought that I had the solution but it seems that I can't make it work :

I am trying to send data from Flash to a php page to update the database (it is for a game and I want to update the score table). I am able to do it BUT it reloads the PHP page and therefore the Flash Movie is restarted... which I don't want to.

Here is how it works ( I put a small graphic attached to the post to be clearer) : There is one PHP page called : eatBones.php The game eatBones.swf is embedded inside the eatBones.php page. When the user wants to submit his score it sends it to eatBones.php which do what it has to do to update or not the score table in the dataBase.

So it works fine.... but it reloads the entire page which is really annoying, and I can't figure out how to make it work without reloading. I tried to send the score to a different php page called highscore.php but then it opens the highscore page in the browser which I obviously don't want...

Here is the code I use in the Flash movie to send the data :

var dataOut:LoadVars = new LoadVars();
dataOut.Score=_root.scoreWithBonus;
dataOut.User=_root.user;
dataOut.send("eatBones.php", "POST");

Sorry for the long post!! :cool:

Thanks in advance :) :)

jsebrech
05-18-2006, 08:05 AM
From the documentation for the LoadVars.send() function:
A successful send() method call will always open a new browser window or replace content in an existing window or frame. If you would rather send information to a server and continue playing your SWF file without opening a new window or replacing content in a window or frame, then you should use LoadVars.sendAndLoad().