Sir Hally
Sir Hally

Reputation: 2358

Save Data in Adobe Flash Desktop App

I am making a desktop Flash application (AS3). It provides to users an opportunity to save and open their projects. I've used FileReference to open project file

var fileRef:FileReference = new FileReference();
var ourTypes:Array=new Array(new FileFilter("Map Editor type (*.xml)", "*.xml"));
fileRef.browse(ourTypes);

and use file content by using fileRef.data.

var mainXml:XML;
mainXml=new XML(fileRef.data);

User must have an opportunity to add some data in this file (not only read). How can I save new data in the same file?

Upvotes: 0

Views: 703

Answers (1)

weltraumpirat
weltraumpirat

Reputation: 22604

You can save a file via fileRef.save( data:*, defaultFileName:null), where data is the data object you want to save, in your case mainXML.toString(). This will always open another file dialog, unfortunately, and there's no way to work around it, since it seems to be a security restriction. The only thing you can do is provide a defaultFileName, so the user doesn't have to enter one manually.

Upvotes: 1

Related Questions