Posted By

SinVerguenzaGames on 11/11/15


actionscript games as3

Versions (?)

Post Text Box Text Into Text File

 / Published in: ActionScript 3

This code shows how not only to create a text file onto the local computer desktop, but also how to post the contents of a 'text box' object into the file.

  1. //Sin Verguenza Games - Google Play Store
  2. import flash.filesystem.File;
  3. import flash.filesystem.FileMode;
  4. import flash.filesystem.FileStream;
  5. //store the text box text into a variable that will be used later in the code
  6. var printerData = printer.text.toString();
  7. var file: File = File.desktopDirectory.resolvePath("score.txt");
  8. var stream: FileStream = new FileStream();
  9., FileMode.WRITE);
  10. //this line below actually posts the text box text into the created file
  11. stream.writeUTFBytes (printerData);
  12. stream.close();
  13. //Orlando Florida USA

Report this snippet  

You need to login to post a comment.