Since you are using AIR look at using File instead of FileReference.
--- In flexcoders@yahoogroups.com, "edlueze" <edlu...@...> wrote:
>
> Hi Folks:
>
> I am trying to use the FileReference.save() function in AIR to save an XML
> object to the local file system. I'm using the following code:
>
> ================================================
> public static function exportAllTablesToLocalFile():void {
>
> var xmlAllProjectFiles:XML = <ProjectFiles />;
>
> //Consolidate all of the Project Files together
> xmlAllProjectFiles.appendChild( Alerts.xmlAlerts );
> xmlAllProjectFiles.appendChild( Charts.xmlCharts );
> //etc...
>
> var fileReference:FileReference = new FileReference(); //FileReference
> points to the local file
> fileReference.save(xmlAllProjectFiles, "AllProjectFiles.xml"); //Save the
> table as a local file
> }
> ================================================
>
> This code works perfectly fine, but I've noticed that it will lock the file.
> Consequently if I try and replace the file the operation will silently fail!
>
> The same thing doesn't seem to happen using regular Flex within a browser
> when I try it with similar test code.
>
> Is this a problem with AIR or am I doing something wrong? Should I be closing
> the file after it's been saved. Should I be doing something with the
> FileReference complete message?
>
> Thanks!
>