AS3 中的 LocalConnections 如何通信?
我将开始在几个 SWF 中使用 LocalConnections 让它们相互通信。但在我走这条路之前,我需要确保它不会导致系统出现任何弹出窗口和确认对话框。
如果我使用本地套接字服务器,这会导致 Windows 防火墙和许多其他服务器对其进行标记并要求确认。所以如果 LocalConnection 使用套接字,那么我就不能使用它。
但我通过一些网络搜索了解到它实际上使用共享内存工作,这不会导致任何防火墙抱怨。
使用过 LocalConnection 的人可以确认或否认它会导致主机操作系统出现问题吗?尤其是Win7/Vista。
I'm about to start using LocalConnections in a couple SWF's to let them talk to each other. But before I head down this road, I need to make sure it's not going to cause any popups and confirmation dialogs to appear from the system.
If I use a local socket server, that causes the Windows firewall and many others to flag it and require confirmation. So if LocalConnection uses sockets, then I can't use it.
But I've read via some web searching that it actually works using shared memory, which won't cause any firewalls to complain.
Can anyone who has used LocalConnection confirm or deny that it causes problems with the host OS? Particularly with Win7/Vista.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我已经使用
LocalConnection
(用于查看服务器托管的 SWF 的跟踪消息)很长时间了,但从未见过任何弹出窗口。LocalConnectionliveDocs 页面代码> 说:
因此,我想可以安全地假设 flash 播放器负责使用 LocalConnection 的 swf 之间的通信,并且不会涉及任何弹出窗口。
I have been using
LocalConnection
(for viewing the trace messages of my server hosted SWF's) for a long time, and have never seen any popups. The liveDocs page ofLocalConnection
says that:So I guess it's safe to assume that flash player is responsible for the communication between swfs using LocalConnection and no popups will be involved in it.
我找到了此链接,它证明 LocalConnections 可以使用与互斥锁同步的共享内存。
但它有点旧了(2007 年),我目前正在使用 AS3 来使用 Flash 10 播放器。
I found this link, which proves that LocalConnections work with shared memory synchronized with a mutex.
But it's a little old (2007) and I'm currently working with the Flash 10 player using AS3.
我在具有相当广泛的 QA 测试的环境中使用了 LocalConnection。它有一些奇怪的事情,但总的来说,它似乎可以在各种平台上可靠地工作,而不会对用户产生影响。
奇怪的事情是:我们遇到的一个问题是,直到计算机上的 Flash 播放器的所有实例都被关闭后,内存文件和互斥体才会被释放。当其中一个 Flash 播放器实例死亡或被终止并且未释放 LocalConnection 时,就会出现此问题。可以传入 flashvars 的仲裁器告诉每个 SWF 在运行时使用哪个本地连接,允许您每次指定一个新的本地连接。当然,如果这种情况发生很多,它会通过填充内存来加剧问题......
另一个问题是,看起来(仅从观察来看 - 没有证据支持这一说法)互斥体的实现可能有点幼稚。向单个本地连接添加太多侦听器/发送器有些不可靠。我们通过简单地使用 LocalConnections 作为一种调度方式、一个发送者、一个接收者来避免出现此问题。这个问题在这里有很好的描述
I've used LocalConnection in an environment with fairly extensive QA testing. There are a couple of odd things about it, but in general, it seems to work across a variety of platforms reliably without implications for the user.
Of the odd things: One problem we encountered was that the memory file and mutex aren't released until all instances of the flash player on the computer have been shutdown. This is an issue in the case where one of the flash player instances died or was killed and didn't release the LocalConnection. An arbiter that can pass in flashvars telling each SWF which local connection(s) to use at runtime allows you to specify a new local connection each time. Of course, if this happens a lot, it will exacerbate the problem by filling up memory...
The other problem is that it seems (Just from observation -- No evidence to back up the claim) that the mutex implementation may be somewhat naive. Adding too many listener/senders to a single local connection is somewhat un-reliable. We avoided problems with this by simply using LocalConnections as one way dispatches, one sender, one receiver. This problem is well described here