Save data into external files in AS3, with out ser

2019-08-28 22:06发布

问题:

HI

How can I save some text information in local hard-disk with out the server support. I know shared object, but i dont use this. I need to save all these function in anther external file as text.

Is there any way to do that in AS3.0.

I don't prefer Flex, am working in Action Script 3.0 & Flash IDE

EDIT:

My swf is saved in a local machine. So no server interaction or browser interaction. the swf is running a local folder and read txt files from local folder, and save once press the save button.

回答1:

Use the save method of class FileReference since Flash Player 10.0



回答2:

How can I save some text information in local hard-disk with out the server support.

How are you defining local in this case? Local to the server or local to the client? Nothing server side is going to help you save anything local to the client. Also, nothing client side is going to help you save anything to the server.

You can use Shared Objects to store local information from the Flash Player. These are like cookies, though, and are probably not what you're looking for.

If this is an AIR app you can use the File API to save local files. These APIs are not available when running a web app, though.

If you're okay with prompting users for the save location, you can use the FileReference.save method.

If the file already exists on the server, you could link to it, causing the browser to handle it. Browser settings will determine what actually happens, though. IT may try to render the file, it may prompt the user to download, or open it.



回答3:

You could try to use XML to save and retrieve data ( it could act as a local database)