从Flash中的得分变量获取价值 [英] getting value from score variable in Flash

查看:86
本文介绍了从Flash中的得分变量获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编辑Flash游戏,我希望每当用户按下提交"按钮时,他的分数就应该保存在服务器上的数据库中.我如何实现此任务?我已经获得了存储分数的变量.我可以将其发送到我的数据库中.

I am editing a flash game,I want that whenever user press the submit button,his score should be saved in the database at my Server.How i can achieve this task?I had got the variable in which score is stored.I can i send this to my database.

推荐答案

您需要某种可以与之通信的服务器端脚本语言,闪存代码无法直接将内容插入数据库,而只能对数据进行编码用于通过网络传输,并将其传递到服务器端脚本,然后可以将其插入数据库.基本上,这是出于安全原因,通常来说,您不只是希望数据库开放供人们从Internet上的任何位置插入数据库.您可以使用PHP或Java或C#或Perl或Python或其他各种语言来实现连接数据库和插入从Flash Player接收的数据的任务.有关事物的AS3方面的更多信息,请点击此处:

You need some sort of server side scripting language that you can communicate with, the flash code can't directly insert things into a database it can only encode the data for transmission across the network and deliver it to a server side script that can then insert it into the database. This is basically for security reasons generally speaking you don't just want your database open for people to insert things into it from wherever on the internet. You can use PHP or Java or C# or Perl or Python or all sorts of other languages to achieve the task of connecting to a database and inserting the data received from the flash player. For more info on the AS3 side of things look here:

以下摘自此页: http://help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/net/URLRequest.html#methodSummary

注意:要运行示例,示例中的远程应用程序URL 必须替换为有效的网址.此外,您还需要 服务器代码以处理Flash Player在 URLVariables对象.

Note: To run the example, the remote application URL in the example must be replaced with a working URL. Additionally, you would need server code to process the information captured by Flash Player in the URLVariables object.

软件包{ 导入flash.display.Sprite; 导入flash.net.navigateToURL; 导入flash.net.URLRequest; 导入flash.net.URLVariables;

package { import flash.display.Sprite; import flash.net.navigateToURL; import flash.net.URLRequest; import flash.net.URLVariables;

public class URLVariablesExample extends Sprite {

    public function URLVariablesExample() {
        var url:String =

"http://www.[yourDomain] .com/application.jsp"; var request:URLRequest = new URLRequest(url); var variable:URLVariables = new URLVariables(); variables.exampleSessionId = new Date().getTime(); variables.exampleUserLabel =来宾"; request.data =变量; navigationToURL(request); } }

"http://www.[yourDomain].com/application.jsp"; var request:URLRequest = new URLRequest(url); var variables:URLVariables = new URLVariables(); variables.exampleSessionId = new Date().getTime(); variables.exampleUserLabel = "guest"; request.data = variables; navigateToURL(request); } } }

这篇关于从Flash中的得分变量获取价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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