728
ActionScript classes
As discussed in the entry
LocalConnection.connect()
, Flash adds the current superdomain
to
connectionName
by default. If you are implementing communication between different
domains, you need to define
connectionName
in both the sending and receiving
LocalConnection objects in such a way that Flash does not add the current superdomain to
connectionName
. You can do this in one of the following two ways:
■
Use an underscore (_) at the beginning of
connectionName
in both the sending and
receiving LocalConnection objects. In the SWF file containing the receiving object, use
LocalConnection.allowDomain
to specify that connections from any domain will be
accepted. This implementation lets you store your sending and receiving SWF files in any
domain.
■
Include the superdomain in
connectionName
in the sending LocalConnection object--for
example,
myDomain.com:myConnectionName
. In the receiving object, use
LocalConnection.allowDomain
to specify that connections from the specified
superdomain will be accepted (in this case, myDomain.com) or that connections from any
domain will be accepted.
When using this method, consider the Flash Player security model. By default, a
LocalConnection object is associated with the sandbox of the SWF file that created it, and
cross-domain calls to LocalConnection objects are not allowed unless the
LocalConnection.allowDomain()
method has been invoked.
For more information, see the following:
■
Chapter 17, "Understanding Security," in
Learning ActionScript 2.0 in Flash
■
The Flash Player 8 Security white paper at http://www.macromedia.com/go/fp8_security
■
The Flash Player 8 Security-Related API white paper at http://www.macromedia.com/go/
fp8_security_apis
Availability:
ActionScript 1.0; Flash Player 6
Parameters
connectionName
:String
- A string that corresponds to the connection name specified in the
LocalConnection.connect()
command that wants to communicate with
sending_lc
.
methodName
:String
- A string specifying the name of the method to be invoked in the
receiving LocalConnection object. The following method names cause the command to fail:
send
,
connect
,
close
,
domain
,
onStatus
, and
allowDomain
.
args
:Object
[optional] - Arguments to be passed to the specified method.
NO
TE
You cannot specify a superdomain in
connectionName
in the receiving
LocalConnection
object-- you can only do this in the sending
LocalConnection
object.
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...