Overwrite files automatically?
Hi
I'm writing an Air app that creates and writes an HTML page to the user's hard drive. If the file already exists, it should be overwritten.
I was wondering if there is a way via AS3 to stop the prompt that asks if the users wants the file overwritten, and just automatically do it each time?
The Air program takes the contents of a text box (which contains the HTML page code) and then writes page.php to the hard drive. The code I use is this:
docsDir = File.documentsDirectory.resolvePath( "page.php" );
docsDir.browseForSave("Save As");
docsDir.addEventListener(Event.SELECT, saveData);
function saveData(event:Event):void
{
var newFile:File = event.target as File;
var str:String = outputBox.text;
var stream:FileStream = new FileStream();
stream.open(newFile, FileMode.WRITE);
stream.writeUTFBytes(str);
stream.close();
}
Is it something simple, or can it not be done due to security restrictions?
