Flash/Flex Rails 远程处理。 AMF、WebORB,不太确定该使用什么

发布于 2024-10-08 08:50:09 字数 498 浏览 2 评论 0原文

我正在尝试构建一个将游戏数据发送到 Rails 应用程序的游戏。我已经用 javascript 构建了它,但很明显 Flash 会做得更好,所以现在我将用 Flash 构建它。如果有人感兴趣,可以使用 projects sprouts 这是一个 ruby​​ 包装器来构建 as3 项目。

我对将 Rails 应用程序与 Flash 连接进行了大量研究。我实际上不需要使用flex,但这是sprouts使用的os sdk。有WebORB。其测试过程一团糟,而且非常复杂。然后是 Ruby AMF,它有多个 gem 和插件。我真的不太确定该用什么。

毕竟,我只是想启动并运行一些东西。我只需要一个 .swf 来获取 ruby​​ 中的数组,然后发回“是”或“否”响应,即用户是否通过级别。

因此,我再次寻找一种将 Flash/Flex 与我的 Rails 应用程序连接的方法。这是一种既简单又适用于 Rails 3 的方法。

I'm trying to build a game that sends game play data to a rails app. I've built it in javascript but it's quite obvious that Flash is going to do a better job so now I am about to build it in Flash. Using projects sprouts which is a ruby wrapper to build as3 projects if anyone is interested.

I've done a lot of research on connecting Rails apps with Flash. I actually don't need to use flex but that is the os sdk that sprouts uses. There is WebORB. The turotrials for that are a mess and are really complicated. Then Ruby AMF which has multiple gems and plugins. I'm really not quite sure what to use.

After all, I just want to get something up and running. I just need a .swf to get an array in ruby and then send back a yes or no response that being if the user passed the level or not.

So again I'm looking for a way to connect Flash/Flex with my Rails App. A method that is both easy and going to be around for Rails 3.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝影如岚 2024-10-15 08:50:09

我认为最好的方法是通过简单的 API 调用来调用一个简单的 Rails 操作。例如(rails):

https://whatever.com/games /new?parameter1=something¶meter2=something&apk=3423aad23h234h2827237322373232234234

其中 apk 是您分配给启用 api 的用户(例如,在您的用户控制器中)的 api 密钥。这可以防止在 Rails 端对您的应用程序进行随意的黑客攻击。由于您正在对其两侧(Flash 和 Rails 侧)进行编程,因此您可以使用基于日期或其他内容的另一个哈希来提高安全性。

为了将 Ruby 数组返回到 Flash 应用程序,只需执行类似以下操作即可获取 XML 或 JSON 并在 Flash 端解析它(下面是简单的创建操作):

            format.json  { render :json => @this_entry, :status => :created, :location => @this_entry }
            format.xml  { render :xml => @this_entry, :status => :created, :location => @this_entry }

I think that the best way is to have either a simple Rails action that is called via a simple API call. For example (rails):

https://whatever.com/games/new?parameter1=something¶meter2=something&apk=3423aad23h234h2827237322373232234234

where the apk is an api key that you assign to users that are api enabled (in your users controller, for instance). This would keep out casual hacks of your app on the Rails side. Since you're programming both sides of it (the Flash and Rails sides), you could extra security with another hash based on date or something.

For the Ruby array to return to the Flash app, just do something like this to either get back XML or JSON and parse it on the Flash side (simple create action below):

            format.json  { render :json => @this_entry, :status => :created, :location => @this_entry }
            format.xml  { render :xml => @this_entry, :status => :created, :location => @this_entry }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文