User Guide

Connecting to other Flash Player instances 379
Connecting to other Flash Player
instances
The LocalConnection class lets you communicate between different Flash Player instances,
such as a SWF in an HTML container or in an embedded or stand-alone player. This allows
you to build very versatile applications that can share data between Flash Player instances,
such as SWF files running in a web browser or embedded in C# applications.
LocalConnection class
The LocalConnection class lets you develop SWF files that can send instructions to other
SWF files without the use of the
fscommand() method or JavaScript. LocalConnection
objects can communicate only among SWF files that are running on the same client
computer, but they can run in different applications. For example, a SWF file running in a
browser and a SWF file running in a projector can share information, with the projector
maintaining local information and the browser-based SWF connecting remotely. (A projector
is a SWF file saved in a format that can run as a stand-alone application—that is, the
projector doesnt require Flash Player to be installed because it is embedded inside the
executable.)
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:
LocalConnection objects created in ActionScript 1.0 or 2.0 can communicate with
LocalConnection objects created in ActionScript 3.0. Flash Player handles this
communication between LocalConnection objects of different versions automatically.
The simplest way to use a LocalConnection object is to allow communication only between
LocalConnection objects located in the same domain because that way, you wont have
security issues. However, if you need to allow communication between domains, you have
several ways to implement security measures. For more information, see the discussion of the
connectionName parameter in send() and the allowDomain() and domain entries in the
ActionScript 3.0 Language Reference.
TIP
It is possible to use LocalConnection objects to send and receive data within a single
SWF file, but Adobe does not recommended doing so. Instead, you should use shared
objects.