Created
December 16, 2017 12:05
-
-
Save unitycoder/c05a2bf6740764bbd03e3bc105d8b5f7 to your computer and use it in GitHub Desktop.
Flash AS3 AIR : Create Plain Text File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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