Reputation: 75
I need to save a file in Flash without a prompt; what my program does is it gets all the frames from the stage and then it saves them as png files, along with a text file that has the name of the object, and some other properties about it. The code that I have does save it without any problems, but I need it to not prompt me, because I have lots of frames to do this with.
Is there a way to do this with Flash the program or actionscript?
Upvotes: 1
Views: 974
Reputation: 52133
The only way to save a local file with the Flash Player (in the browser) is with FileReference
and it will always prompt the user.
However, using AIR (desktop or mobile app) you can save to the local file system without user input, using File
and FileStream
. You can create an AIR app using Flash Pro, usually without any code changes other than the AIR APIs you need (flash.filesystem
in this case).
Another idea, if you must use Flash Player and not AIR, is to first zip all the PNGs and only save to file after they are all packaged. This way there's only one file and prompt to save.
Upvotes: 2
Reputation: 4750
No, unless you're using Adobe AIR. The reason for this is Flash Player and its programs are generally run through a browser over the Internet, and if people could use Flash Player to just start saving files on other people's computers, there would be some very serious security issues. AIR, on the other hand, is generally run on a desktop, laptop, or mobile device, and its programs are run directly off the same, having been pre-installed. So whereas a website can suddenly just start running a script with Flash Player without asking you first, AIR requires you to have already installed the script/program on your computer, meaning that it should be there intentionally. So security restrictions are lighter, enabling the use of the File class in your programs.
Upvotes: 2