O'Reilly logo

ActionScript 3.0 Bible by Roger Braunstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 44. Local Connections between Flash Applications

FEATURED CLASSES

  • flash.net.LocalConnection

Using the LocalConnection class, you can enable multiple Flash applications running on the same computer to communicate with each other. This is interprocess communication (IPC) for the Flash platform. I covered client-server communication in Chapter 28, "Communicating with Remote Services": here I introduce client-client communication. Local connections work without a network connection of any kind, directly between ActionScript running in both applications.

Local Connections and Their Uses

Local connections enable communication between one or more Flash platform applications on the same computer without additional tooling. Just like most of the client-server techniques used in Chapter 28, by "communication" I specifically mean "method invocation." After you open a local connection from a sending application A to a receiving application B, application A can call methods, optionally passing arguments, to application B. This connection is one way in that A can only call methods on B. However, you can program a simple handshaking protocol that makes B establish a parallel connection back to A so that one connection exists for each direction, simulating bidirectional communication. Furthermore, the one-directional communication extends to return values: A can call methods on B, but any return values from B methods are lost; they are not sent back to A. The method invocations are asynchronous, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required