动作脚本3.如何获得数据瑞士法郎(AS),以PHP和写入到数据库 [英] Action Script 3. How to get data from swf (as) to php and write to database

查看:441
本文介绍了动作脚本3.如何获得数据瑞士法郎(AS),以PHP和写入到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建Flash记忆的游戏,理念,发现2等于卡。这里是计时器,计时在多少秒内所有的卡被发现。经过完整的游戏计时器停止。我怎样才能从这个时候的swf文件,并写入数据库?据我了解,我需要借这个数据与PHP文件,但没有想法如何做到这一点。

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("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没有任何反应,我没有得到任何错误,但我不知道如何在PHP或使用该如何写入到数据库中。

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.

我的应用程序将用于Facebook的,这意味着用户名将会使用相同的Facebook。所以,我觉得首先我需要得到的时间比PHP从Facebook获取用户名和写这两个数据库。

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.

感谢您的答案。

推荐答案

尝试使用AMFPHP。 AMFPHP能够为您的应用程序,您可以在您的SWF值存储到数据库,PHP编写的服务。

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.

http://www.silexlabs.org/amfphp/

这篇关于动作脚本3.如何获得数据瑞士法郎(AS),以PHP和写入到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆