Action Script 3. How to get data from swf (as) to php and write to database

I'm creating Flash "memory" game, Idea to discover 2 equal cards. Here is timer which count time in how many seconds all cards are discovered. After complete game timer stops. How can I get this time from swf file and write to database? As I understand I need take this data with php file, but don't have idea how to do It.

As I know I need to do something like that:

        var urlLoader:URLLoader = new URLLoader();
        urlLoader.addEventListener(Event.COMPLETE, scoreSaveResponse,false,0,true);
        var request:URLRequest = new URLRequest("");
        var urlVars:URLVariables = new URLVariables();
            urlVars.time = timer.currentCount;
            urlVars.userName = "yourUserName";

        request.method = URLRequestMethod.POST; = urlVars;

function scoreSaveResponse(e:Event):void {
    //whatever you return from the php page is found in

//LondonDrugs_MediaServices's code 

But could someone explain me how to do It, because If I use this part of code nothing happens, I don't get any errors, but I don't know how to use this in php or how to write it to database.

My app will be used for Facebook, that's mean username will be used the same as in Facebook. So I think first i need to get time to PHP than get username from Facebook and write both to database.

Thank you for answers.


Try to use AMFPHP. AMFPHP makes it possible to write a service for your application where you can store your SWF values into a PHP database.

Need Your Help

@Autowired fails with JUnit & Spring

spring unit-testing junit autowired

Really need help. I used JUnit(4.6) plus Spring(3.0.5) for unit testing. When I tried to autowire a service object in my test class, I got a NoSuchBeanDefinitionException.

Palindrome count in a string

ruby string algorithm palindrome

So, I explored today and was solving my first problem statement in ruby:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.