You can perform various file system operations with JSFL scripts. Some functionality may have different results on computers running Mac OS X. Tables 1 and 2 provide a complete rundown of what you can do with the File API. For your convenience, I've cross-referenced the actual function that will perform the operation you require.
| To do this | Use this function |
|---|---|
| Create a file | FLfile.write() |
| Write to a file | FLfile.write() |
| Add to a file | FLfile.write() |
| Read the contents of a file | FLfile.read() |
| Delete a file | FLfile.remove() |
| Copy a file | FLfile.copy() |
| Determine the existence of a file | FLfile.exists() |
| Get the size of a file | FLfile.getSize() |
| Get the date a file was created | FLfile.getCreationDateObj(), FLfile.getCreationDate() |
| Get the date a file was modified | FLfile.getModificationDateObj(), FLfile.getModificationDate() |
| Find out if a file is read-only | FLfile.getAttributes() |
| Find out if a file is hidden | FLfile.getAttributes() |
| Find out if a file is a system file | FLfile.getAttributes() |
| Make a file writable | FLfile.setAttributes() |
| Make a file hidden | FLfile.setAttributes() |
| Make a file visible | FLfile.setAttributes() |
| Make a file read-only | FLfile.setAttributes() |
| To do this | Use this function |
|---|---|
| Create a folder | FLfile.createFolder() |
| List the contents of a folder | FLfile.listFolder() |
| Delete a folder | FLfile.remove() |
| Determine the existence of a folder | FLfile.exists() |
| Get the date a folder was created | FLfile.getCreationDateObj(), FLfile.getCreationDate() |
| Get the date a folder was modified | FLfile.getModificationDateObj(), FLfile.getModificationDate() |
| Find out if a folder is read-only | FLfile.getAttributes() |
| Find out if a folder is hidden | FLfile.getAttributes() |
| Make a folder hidden | FLfile.setAttributes() |
| Make a folder visible | FLfile.setAttributes() |
| Make a folder read-only | FLfile.setAttributes() |
| Make a folder writable | FLfile.setAttributes() |
Note: All the File API functions can be used in JSFL scripts that are executed on a computer with Flash MX 2004 7.2 installed. Unfortunately, most of the File API methods do not function correctly when running under earlier releases of Flash MX 2004.