var file:FileReference = new FileReference();
stage.addEventListener(MouseEvent.CLICK, onClick);
function onClick(evt:MouseEvent):void {
file.save("some text. nsome more text", "actionsnippet.txt");
}
This is possibly my favorite feature of flash 10. Save any kind of file to the users computer…
The first argument is for the data to put in the file, this can be a String, ByteArray or XML object. The second argument is the name of the file.
As a test I also created one that saved a BitmapData object as a jpeg. But it doesn’t really fall into the category of snippet because it uses the Jpeg Encoder from adobe.








