Showing posts with label flash good concepts. Show all posts
Showing posts with label flash good concepts. Show all posts

How to Save a File from Falsh As 3.0 (File Refference In As 3.0)

Hi,

Here I am writing about save a file from Flash by using Action Script 3.0. Already I have write a post for Filerefference in depth, you can follow that post

and here just I am writing explination about example

To do this First Create a button in Flash and name as "saveFileBut", and create input text filed and name as "myText" and copy and paste following code in

first frame.


var saveFile:FileReference = new FileReference();
saveFileBut.addEventListener(MouseEvent.CLICK, saveMyFile);

function saveMyFile(e:MouseEvent): void {
   saveFile.save(myTex.text);
}




In above code first line we are creating a filerefference object "saveFile" and in second line we are writing listener to button and calling function

"saveMyFile" in this funtion we are saving text written in "myTex" as text file.

For More Information on File Refference you can go through link:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6#save%28%29


Thanks,
K Swamy Vishnubhatla.