Localconnection Class - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

LocalConnection class

Availability
Flash Player 6.
Description
The LocalConnection class lets you develop SWF files that can send instructions to each other
without the use of
among SWF files that are running on the same client computer, but they can be running in
different applications—for example, a SWF file running in a browser and a SWF file running in a
projector. You can use LocalConnection objects to send and receive data within a single SWF file,
but this is not a standard implementation; all the examples in this section illustrate
communication between different SWF files.
The primary methods used to send and receive data are
LocalConnection.connect()
commands; notice that both the
commands specify the same connection name,
// Code in the receiving SWF file
this.createTextField("result_txt", 1, 10, 10, 100, 22);
result_txt.border = true;
var receiving_lc:LocalConnection = new LocalConnection();
receiving_lc.methodToExecute = function(param1:Number, param2:Number) {
result_txt.text = param1+param2;
};
receiving_lc.connect("lc_name");
// Code in the sending SWF file
var sending_lc:LocalConnection = new LocalConnection();
sending_lc.send("lc_name", "methodToExecute", 5, 7);
The simplest way to use a LocalConnection object is to allow communication only between
LocalConnection objects located in the same domain because you won't 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
parameter in
LocalConnection.send()
LocalConnection.domain()
Method summary for the LocalConnection class
Method
LocalConnection.close()
LocalConnection.connect()
LocalConnection.domain()
LocalConnection.send()
400
Chapter 2: ActionScript Language Reference
ActionScript Language Reference
fscommand()
or JavaScript. LocalConnection objects can communicate only
. At its most basic, your code will implement the following
LocalConnection.send()
entries.
Description
Closes (disconnects) the LocalConnection object.
Prepares the LocalConnection object to receive
commands from a
Returns a string representing the superdomain of the
location of the current SWF file.
Invokes a method on a specified LocalConnection object.
LocalConnection.send()
and
:
lc_name
and the
LocalConnection.allowDomain
LocalConnection.send()
CHAPTER 2
and
LocalConnection.connect()
connectionName
and
command.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx

Table of Contents