开发者

connecting javascript to php socket to communicate with Flash

开发者 https://www.devze.com 2023-02-04 17:11 出处:网络
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.

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 开发者_Go百科appreciated.

Many thanks,

Will


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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消