Amit Shrestha

adobe air :: File handling  [Migrating over here,,so check it for further updates] [Check it for further updates in adobe air]

  • The static properties included in File class :

File.applicationStorageDirectory  A unique storage directory unique for each installed AIR application
File.applicationDirectory  Directory where the application is installed and it is read only
File.desktopDirectory  Desktop directory of the User
File.documentsDirectory  Documents directory of the user
File.userDirectory  User Directory

  • saving file:
  1. var bytearray:ByteArray = new ByteArray();
  2. var fileToCopy:File = new File(“url of file”);
  3. var newFile:File = new File(“url of file to be created”);
  4. var fileStream:FileStream = new FileStream();
  6. fileStream.readBytes(bytearray);//getting bytes
  7. var newFileStream :FileStream = new FileStream()
  8. newFileStream.openAsync( newFile, FileMode.WRITE );
  9. newFileStream.writeBytes(bytearray);//filling bytes
  10. newFileStream.close();
  • Updating file

public function update(value:String,url:String,startIndex:int = 0):void
var file:File = new File(url);
var fs:FileStream = new FileStream();,FileMode.UPDATE);
fs.position = startIndex;

  • Getting current directory in air:
  1. NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvokeEvent);
  2. public function onInvokeEvent(invocation:InvokeEvent):void {
  3.         var currentDir:File = invocation.currentDirectory;
  4. }

  • File systems’s tutorial:


  • Adobe Air: Problem while reading „ and “


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: