1 person found this helpful
There are different mechanisms for communications between Flash and a database.
One of the way is - Use LoadVars instances to send and receive data from serverside scripts (PHP, eg) that retrieve and save data to the database. Data may be sent via GET or POST, and is returned with var=value formatting.
Maybe I'm in over my head. I was hoping I could have a single .txt file sitting on the server which would contain the variables.
From my look through the help files it looks like I'd be able to load the variables from here with no problem using URL encoding like this:
But is there a way to write back to this text file to update the variables from Flash without needing any scripting on the server?
I don't have any experience in any scripting other than ActionScript, and I'm still quite new with that.
I afraid not.
But if you can use AS3 then you can make use of SharedObject class and make use of remote shared objects, details here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject. html
Please note you will need Adobe Flash Media Server for using remote shared objects.
Right, I've made significant progress since I started this topic. I now have my Flash and php files set up, and the communication between them is working. I'm having difficulty now retaining my variables in the php and updating them for the next session. The script that I have is as follows:
$totalRating1 += $_POST['latestRating1'];
$averageRating1 = $totalRating1 / $ratingCount1;
The first line receives the variable "latestRating1" from the SWF. The new average rating is calculated and returned to the SWF as "averageRating". When I run it, however, the variables are reset each time. The average rating is always the same as the latest rating. How can I retain the variables so that they are updated and available for the next user?
Any advice would be appreciated. I am very new to php, and don't have any experience with other scripting languages. I'm using ActionScript2.