How do LocalConnections in AS3 communicate?

1.6k views Asked by At

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.

3

There are 3 answers

0
Amarghosh On BEST ANSWER

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 of LocalConnection says that:

LocalConnection objects created in ActionScript 3.0 can communicate with LocalConnection objects created in ActionScript 1.0 or 2.0. The reverse is also true. Flash Player handles this communication between LocalConnection objects of different versions automatically.

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.

0
scobi On

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.

0
Aaron H. On

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