Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Created December 16, 2017 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unitycoder/c05a2bf6740764bbd03e3bc105d8b5f7 to your computer and use it in GitHub Desktop.
Save unitycoder/c05a2bf6740764bbd03e3bc105d8b5f7 to your computer and use it in GitHub Desktop.
Flash AS3 AIR : Create Plain Text File
// maybe need some other imports also, add if needed
import flash.filesystem.File;
import flash.filesystem.FileStream;
import flash.filesystem.FileMode;
// saves file to C:\Users\username\AppData\Roaming\APPID\Local Store\
var myfile:File = File.applicationStorageDirectory.resolvePath("hello.txt");
var mystring = "Hello World!";
// create file
fileStream.open(myfile, FileMode.WRITE);
// output to it
fileStream.writeUTFBytes(mystring);
// close
fileStream.close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment