title: Action Script 3. How to get data from swf (as) to php and write to database
body: <p>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.</p>
  
  <p>As I know I need to do something like that:</p>
  
  <pre><code>        var urlLoader:URLLoader = new URLLoader();
          urlLoader.addEventListener(Event.COMPLETE, scoreSaveResponse,false,0,true);
          var request:URLRequest = new URLRequest("http://mysite.com/score.php");
          var urlVars:URLVariables = new URLVariables();
              urlVars.time = timer.currentCount;
              urlVars.userName = "yourUserName";
  
          request.method = URLRequestMethod.POST;
          urlLoader.data = urlVars;
          urlLoader.load(request);
  
  function scoreSaveResponse(e:Event):void {
      //whatever you return from the php page is found in urlLoader.data
  }
  
  //LondonDrugs_MediaServices's code 
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Thank you for answers.</p>