Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 478

Programming actionscript 3.0
Table of Contents

Advertisement

To retrieve a socket policy file from the same port as a main socket connection, simply call the
or
method, and, if the specified domain is not
Socket.connect()
XMLSocket.connect()
the same as the domain of the calling SWF file, Flash Player automatically attempts to retrieve
a policy file from the same port as the main connection you are attempting. To retrieve a
socket policy file from a different port on the same server as your main connection, call the
method with the special
syntax, as in the
Security.loadPolicyFile()
"xmlsocket"
following:
Security.loadPolicyFile("xmlsocket://server.com:2525");
Call the
method before calling the
or
Security.loadPolicyFile()
Socket.connect()
method. Flash Player then waits until it has fulfilled your policy file
XMLSocket.connect()
request before deciding whether to allow your main connection.
If you are implementing a socket server and you need to provide a socket policy file, decide
whether you will provide the policy file using the same port that accepts main connections, or
using a different port. In either case, your server must wait for the first transmission from your
client before deciding whether to send a policy file or set up a main connection. When Flash
Player requests a policy file, it always transmits the following string as soon as a connection is
established:
<policy-file-request/>
Once the server receives this string, it can transmit the policy file. Do not expect to reuse the
same connection for both a policy file request and a main connection; you should close the
connection after transmitting the policy file. If you do not, Flash Player closes the policy file
connection before reconnecting to set up the main connection.
For more information, see
"Socket policy files" on page
458.
Sending data
Data sending occurs when ActionScript code from a SWF file sends data to a server or
resource. Sending data is always permitted for network domain SWF files. A local SWF file
can send data to network addresses only if it is in the local-trusted or local-with-networking
sandbox. For more information, see
"Local sandboxes" on page
462.
You can use the
function to send data to a URL. Other methods
flash.net.sendToURL()
also send requests to URLs. These include loading methods, such as
and
Loader.load()
, and data-loading methods, such as
and
Sound.load()
URLLoader.load()
.
URLStream.load()
478
Flash Player Security

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents