I've been searching solution for a week now. There are few problems.
1. I'm trying to save highscore from Flash to PHP (WORKS)
2. I'm trying to retrieve highscore form PHP to Flash (LOSING MY SANITY)
So my sending variables works, but getting them back doesn't.
Here's the code:
*This method is for getting the results from PHP
private function getMyResults():void
var myLoader:URLLoader = new URLLoader();
var myRequest:URLRequest = new URLRequest("Database/highscore.php");
myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
*This method fills text boxes in fla file with retrieved data
private function onDataLoad(event:Event):void
var loader1:URLLoader = URLLoader(event.target);
for(var i:Number = 0; i < loader1.data.cant; i++)
this["Ime"+i].text = loader1.data["Ime"+i];
this["Bodovi"+i].text = loader1.data["Bodovi"+i];
//tracing loaded data
//this is irrelevant - only graphic for game
isponova_btn.visible = true;
isponova_btn.enabled = true;
Ok, here is the deal. If I have absolute path in URLRequest:
var myRequest:URLRequest = new URLRequest("http://localhost/zapamtiMe/Database/highscore.php");
it WORKS! But only on my machine. When I upload it to internet (on my server) it doesn't work. (I change the path of course).
I don't get why relative path won't work on my machine or anywhere.
When relative path is in the place, i load php code, not echoed values of that php code.
Ime means player's name, and Bodovi means player's score.
So relative path is returning php code. I don't get it.
With absolute code, it works when I test my movie in flash, I get results which I want, but PROBLEM is when I test on my localhost (html file) it stops and results are not written in flash.
HINT: It seems (by not loaded graphic which should load) that it stops on onDataLoad function.
I'll attach PHP code from highscore.php:
$result=mysql_query("SELECT Ime, Bodovi FROM ".$imetablice." WHERE 1 ORDER BY Bodovi DESC LIMIT 10");
$cant = 0;
I repeat, highscore.php is working fine, echoing the right thing on screen, but seems like Flash is messing with my head...
I have save.php which saves data to MySQL and it works fine (I also used URLLoader and relative path).
So it WORKS when I have absolute path to highscore.php and when I test it in Flash, anywhere else it DOESN'T WORK (localhost, web server...)
Can anyone help me?
I would be very grateful...