Save File in AS3

Opens a dialog box that lets the user save a file to the local filesystem. Although Flash Player has no restriction on the size of files you can upload, download, load or save, the player officially supports sizes of up to 100 MB.

The save() method first opens a dialog box that asks the user to enter a filename and select a location on the local computer to save the file. once Selected and confirms the save operation (for example, by clicking Save), the save process begins. Listeners receive events to indicate the progress, success, or failure of the save operation.

FileReference save method has only to be invoked upon user interaction, for example by a mouse click or button press.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”” layout=”absolute” >
private var file:FileReference = new FileReference();
private function onCreate(e:Event):void
var Txt:String=”Hello World”,”Sample.txt”); // Initiates the save event and opens up a dialog box for user to enter filename and select a location. Once confirmed, it get saved
} ]]>
<mx:Button x=”133″ y=”209″ label=”Create File” click=”onCreate(event)”/>