header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.

Save file in Adobe AIR without dialog window
Posted By : Inder | Posted At: 4/10/2010 3:16:04 AM



Tutorial: Save file without dialog window in Adobe AIR.
Technology: Adobe AIR, Adobe Flash, Flash Builder, Adobe Flex, Actionscript 3.0.
Description: Saving a file from flash without prompting the user is only possible in flash application running on Adobe AIR environment.Check the tutorial and example below.

Content: Following is the source code to write a file on a user system using flash. First we set the reference to the path where we want to save our text file. In this case I have set it to desktop directory. As soon as you execute this function from inside an Adobe AIR application you will find a test.txt file saved on your desktop without even prompting you for the save dialog window.

    import flash.filesystem.*;
	import flash.events.Event;

function saveFile():void {
	var file:File=File.desktopDirectory;
	file=file.resolvePath("test.txt");
	var fileStream:FileStream = new FileStream();
	fileStream.open(file, FileMode.WRITE);
	fileStream.writeUTFBytes("Hi this file was saved from AIR application without dialog");
	fileStream.addEventListener(Event.CLOSE, fileClosed);
	fileStream.close();

	function fileClosed(event:Event):void {
		trace("closed event fired");
	}
}
saveFile();
    
    



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions