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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Working with the file system<br />

Pointing to the desktop directory<br />

Adobe AIR 1.0 and later<br />

You can point a File object to the desktop. The following code sets a File object to point to an AIR Test subdirectory<br />

of the desktop:<br />

var file:File = File.desktopDirectory.resolvePath("AIR Test");<br />

Pointing to the application storage directory<br />

Adobe AIR 1.0 and later<br />

You can point a File object to the application storage directory. For every AIR application, there is a unique associated<br />

path that defines the application storage directory. This directory is unique to each application and user. You can use<br />

this directory to store user-specific, application-specific data (such as user data or prefer<strong>en</strong>ces files). For example, the<br />

following code points a File object to a prefer<strong>en</strong>ces file, prefs.xml, contained in the application storage directory:<br />

var file:File = File.applicationStorageDirectory;<br />

file = file.resolvePath("prefs.xml");<br />

The application storage directory location is typically based on the user name and the application ID. The following<br />

file system locations are giv<strong>en</strong> here to help you debug your application. You should always use the<br />

File.applicationStorage property or app-storage: URI scheme to resolve files in this directory:<br />

On Mac OS — varies by AIR version:<br />

AIR 3.2 and earlier: /Users/user name/Library/Prefer<strong>en</strong>ces/applicationID/Local Store/<br />

AIR 3.3 and later: path/Library/Application Support/applicationID/Local Store, where path is either<br />

/Users/username/Library/Containers/bundle-id/Data (sandboxed <strong>en</strong>vironm<strong>en</strong>t) or /Users/username (<br />

wh<strong>en</strong> running outside a sandboxed <strong>en</strong>vironm<strong>en</strong>t)<br />

For example (AIR 3.2):<br />

/Users/babbage/Library/Prefer<strong>en</strong>ces/com.example.TestApp/Local Store<br />

On Windows—In the docum<strong>en</strong>ts and Settings directory, in:<br />

C:\Docum<strong>en</strong>ts and Settings\user name\Application Data\applicationID\Local Store\<br />

For example:<br />

C:\Docum<strong>en</strong>ts and Settings\babbage\Application Data\com.example.TestApp\Local Store<br />

On Linux—In:<br />

/home/user name/.appdata/applicationID/Local Store/<br />

For example:<br />

/home/babbage/.appdata/com.example.TestApp/Local Store<br />

On Android—In:<br />

/data/data/androidPackageID/applicationID/Local Store<br />

For example:<br />

/data/data/air.com.example.TestApp/com.example.TestApp/Local Store<br />

On AIR for TV devices, the location is described in “Directory view for AIR for TV applications” on page 670.<br />

Last updated 6/6/2012<br />

672

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

Saved successfully!

Ooh no, something went wrong!