/ 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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//Sin Verguenza Games - Google Play Store import flash.filesystem.File; import flash.filesystem.FileMode; import flash.filesystem.FileStream; //store the text box text into a variable that will be used later in the code var printerData = printer.text.toString(); var file: File = File.desktopDirectory.resolvePath("score.txt"); var stream: FileStream = new FileStream(); stream.open(file, FileMode.WRITE); //this line below actually posts the text box text into the created file stream.writeUTFBytes (printerData); stream.close(); //[email protected] 2015 //Orlando Florida USA