Adobe AIR - Save text to local text file


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. public var file:FileReference = new FileReference();
  2.  
  3. public function doSave( event:Event ):void
  4. {
  5. // txtField is the instance name of a text field with contents to save.
  6. var data:ByteArray = new ByteArray();
  7. data.writeMultiByte ( txtField.text, "utf-8" );
  8. file.save( data, "myfile.txt" );
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.