Search code examples
actionscript-3flashactionscriptsavefilereference

How to save a file to a specific destination (so no "Save As" dialog box)


I'm attempting to save an image in flash, with the current code:

var fileReference:FileReference = new FileReference();
fileReference.save(byteArray);

That code opens up a "Save As" dialog box, prompting the user to pick a destination for where the file should be saved.

I want to specify a specific location for the file in the code, so the prompting of the "Save As" box is not necessary.

I've tried to add a second argument to fileReference.save(); but that seems to only set the default file name, not the path:

fileReference.save(byteArray,"myfile.jpeg");

Any ideas on how I could do so?


Solution

  • If this is a Flash Player web project and not an AIR project, then I'm afraid you're out of luck. All file access operations in Flash Player have to go through the user for security reasons.