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 />

Working with the file system<br />

Because the Ev<strong>en</strong>t.COMPLETE ev<strong>en</strong>t is added to each individual FileRefer<strong>en</strong>ce object in the array, Flash Player calls the<br />

completeHandler() method wh<strong>en</strong> each individual file finishes uploading.<br />

Using the AIR file system API<br />

Adobe AIR 1.0 and later<br />

The Adobe AIR file system API includes the following classes:<br />

File<br />

FileMode<br />

FileStream<br />

The file system API lets you do the following (and more):<br />

Copy, create, delete, and move files and directories<br />

Get information about files and directories<br />

Read and write files<br />

AIR file basics<br />

Adobe AIR 1.0 and later<br />

For a quick explanation and code examples of working with the file system in AIR, see the following quick start articles<br />

on the Adobe Developer Connection:<br />

Building a text-file editor (Flash)<br />

Building a text-file editor (Flex)<br />

Building a directory search application (Flex)<br />

Reading and writing from an XML prefer<strong>en</strong>ces file (Flex)<br />

Compressing files and data (Flex)<br />

Adobe AIR provides classes that you can use to access, create, and manage both files and folders. These classes,<br />

contained in the flash.filesystem package, are used as follows:<br />

File classes Description<br />

File File object repres<strong>en</strong>ts a path to a file or directory. You use a file object to create a pointer to a file or<br />

folder, initiating interaction with the file or folder.<br />

FileMode The FileMode class defines string constants used in the fileMode parameter of the op<strong>en</strong>() and<br />

op<strong>en</strong>Async() methods of the FileStream class. The fileMode parameter of these methods determines<br />

the capabilities available to the FileStream object once the file is op<strong>en</strong>ed, which include writing, reading,<br />

app<strong>en</strong>ding, and updating.<br />

FileStream FileStream object is used to op<strong>en</strong> files for reading and writing. Once you’ve created a File object that<br />

points to a new or existing file, you pass that pointer to the FileStream object so that you can op<strong>en</strong> it and<br />

read or write data.<br />

Some methods in the File class have both synchronous and asynchronous versions:<br />

File.copyTo() and File.copyToAsync()<br />

Last updated 6/6/2012<br />

666

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

Saved successfully!

Ooh no, something went wrong!