
28
Example
The following line of code updates a text box in the user interface with the current width value.
myTextField.text=myCam.width;
See also the example for Camera.setMode.
See also
Camera.height, Camera.setMode
LocalConnection (object)
Availability
• Flash Player 6.
• Flash Communication Server MX (not required).
The LocalConnection object lets you develop Flash movies that can send instructions to each
other without the use of
FSCommand or JavaScript. LocalConnection objects can communicate
only between movies that are running on the same client machine, but they can be running in
two different applications—for example, a Flash movie running in a browser and a Flash movie
running in a projector. You can use LocalConnection objects to send and receive within a single
movie, but this is not a standard implementation; all the examples in this section illustrate
communication between different movies.
The primary methods used to send and receive data are
LocalConnection.send and
LocalConnection.connect
. At its most basic, your code will implement the following
commands; note that both the
LocalConnection.send and LocalConnection.connect
commands specify the same connection name,
lc_name:
// Code in the receiving movie
receivingLC = new LocalConnection();
receivingLC.methodToExecute = function(param1, param2)
{
// Code to be executed
}
receivingLC.connect("lc_name");
// Code in the sending movie
sendingLC = new LocalConnection();
sendingLC.send("lc_name", "methodToExecute", dataItem1, dataItem2)
The simplest way to use the LocalConnection object is to allow communication only between
LocalConnection objects located in the same domain, since you won’t have to address issues
related to security. However, if you need to allow communication between domains, you have a
number of ways to implement security measures. For more information, see the discussion of the
connectionName parameter in LocalConnection.send, and also the
LocalConnection.allowDomain and LocalConnection.domain entries.
Comentários a estes Manuais