13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Security<br />

Protecting data<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

To protect data from eavesdropping and alteration as it travels over the Internet, you can use the Transport Layer<br />

Security (TLS) or Socket Layer Security (SSL) on the server where the data originates. You can th<strong>en</strong> connect to the<br />

server using the HTTPS protocol.<br />

In applications created for AIR 2 or above, you can also protect TCP socket communications. The SecureSocket class<br />

allows you to initiate a socket connection to a socket server that uses TLS version 1or SSL version 4.<br />

S<strong>en</strong>ding data<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

Data s<strong>en</strong>ding occurs wh<strong>en</strong> code s<strong>en</strong>ds data to a server or resource. S<strong>en</strong>ding data is always permitted for cont<strong>en</strong>t from<br />

a network domain. A local SWF file can s<strong>en</strong>d data to network addresses only if it is in the local-trusted, local-withnetworking,<br />

or AIR application sandbox. For more information, see “Local sandboxes” on page 1033.<br />

You can use the flash.net.s<strong>en</strong>dToURL() function to s<strong>en</strong>d data to a URL. Other methods also s<strong>en</strong>d requests to URLs.<br />

These include loading methods, such as Loader.load() and Sound.load(), and data-loading methods, such as<br />

URLLoader.load() and URLStream.load().<br />

Uploading and downloading files<br />

Flash Player 9 and later, Adobe AIR 1.0 and later<br />

The FileRefer<strong>en</strong>ce.upload() method starts the upload of a file selected by a user to a remote server. You must call<br />

the FileRefer<strong>en</strong>ce.browse() or FileRefer<strong>en</strong>ceList.browse() method before calling the<br />

FileRefer<strong>en</strong>ce.upload() method.<br />

The code that initiates the FileRefer<strong>en</strong>ce.browse() or FileRefer<strong>en</strong>ceList.browse() method can be called only<br />

in response to a mouse ev<strong>en</strong>t or keyboard ev<strong>en</strong>t. If it is called in other situations, Flash Player 10 and later throws an<br />

exception. However, a user-initiated ev<strong>en</strong>t is not required to call these methods from the AIR application sandbox.<br />

Calling the FileRefer<strong>en</strong>ce.download() method op<strong>en</strong>s a dialog box in which the user can download a file from a<br />

remote server.<br />

Note: If your server requires user auth<strong>en</strong>tication, only SWF files running in a browser—that is, using the browser plugin<br />

or ActiveX control—can provide a dialog box to prompt the user for a user name and password for auth<strong>en</strong>tication, and<br />

only for downloads. Flash Player does not allow uploads to a server that requires user auth<strong>en</strong>tication.<br />

Uploads and downloads are not allowed if the calling SWF file is in the local-with-filesystem sandbox.<br />

By default, a SWF file may not initiate an upload to, or a download from, a server other than its own. A SWF file may<br />

upload to, or download from, a differ<strong>en</strong>t server if that server provides a policy file that grants permission to the domain<br />

of the invoking SWF file.<br />

Last updated 6/6/2012<br />

1059

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!