将 javascript 连接到 php 套接字以与 Flash 通信
我正在尝试为一个大学项目建造一个投影装置,我希望观众能够通过手机与装置进行交流。
这就是我正在尝试做的:
- 我的 Flash 应用程序将在连接到 Internet 的计算机上运行,并将连接到我的服务器上托管的 XMLSocket。
- 我需要一个观众可以访问的javascript页面,鼠标点击(触摸)然后将数据从javascript页面发送到套接字服务器。
- Flash应用程序将接收数据等等..
这可能吗?我一直在寻找各种资源,但它们都需要 Flash 应用程序位于同一页面上,这不是我想要的。
我只需要一个独立的 javascript 页面就能够与 Flash 应用程序对话。
任何有关可能的解决方法的建议或想法将不胜感激。
非常感谢,
威尔
I'm trying to build a projection installation for a university project, I want the audience to be able to communicate with the installation with their mobile phones.
This is what I'm trying to do:
- My Flash application will be running on a computer connected to the internet and will be connected to an XMLSocket hosted on my server.
- I need a javascript page which the audience can visit, mouse clicks (touches) will then send data from the javascript page to the socket server.
- Flash application will receive the data and so on..
Is it possible? I've been looking around for various resources, but they all require a flash app to be on the same page, which is not what I want.
I just need a standalone javascript page to be able to talk to a flash app.
Any suggestions or ideas for possible work arounds will be greatly appreciated.
Many thanks,
Will
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,绝对有可能。服务器位于两者(Flash 和 JS)之间,它们不需要知道彼此的存在。 JS发送数据到服务器,Flash拉下来。
Yes definitely possible. The server sits between the two (Flash and JS), they don't need to know each other exist. JS sends data to the server and Flash pulls it down.
我不确定是否完全理解你的问题。
不存在“javascript 页面”这样的东西,javascript 是...在浏览器环境中运行的脚本。
如果您想使用 Android/iPhone 应用程序环境,我认为您不需要 javascript 来执行此操作。
但是,如果您想要一个可供手机访问的 Web/wap 页面,其中包含用户界面、按钮、文本字段等,可以与 XML 套接字进行双向通信,那么您需要用 HTML 构建用户界面,然后使用一些 javascript 调用 XML 脚本并翻译界面中的响应。如果您有服务器,您不能在那里托管您的 UI 吗?跨域问题将被避免,否则通过任何服务器端脚本(PHP?)就很容易了。
所以是的,这似乎很有可能,但我不明白你所说的“它们都需要 Flash 应用程序位于同一页面上”是什么意思。我的理解是这样的:您的 Flash 应用程序不是您想要在手机中加载的应用程序,它连接到服务器的 XML 输入/输出并且工作正常。您只需要一个与此套接字通信的接口。正确的?
I am not sure to fully understand your question.
There is no such thing as a "javascript page", javascript is a... script running in a browser environment.
In the case you want to use an Android/iPhone app environment I don't think you need javascript to do this.
But if what you want is to have a web/wap page accessible to the mobiles, with a user interface, buttons, text field, whatever, which communicates in both directions with your XML socket, you need to build your user interface in HTML, and then to use some javascript to call your XML script and translate the response in the interface. If you have a server, can't you host also your UI there? The cross-domain issue would be avoided, otherwise it's easy enough through any server-side script (PHP?).
So yes it seems very possible, but I don't see what you mean by "they all require a flash app to be on the same page". Here's what I understood: Your Flash app is not what you want to load in the mobiles, it's connected to the server's XML in/out and working fine. You just want an interface communicating with this socket. Right?