PDA

View Full Version : Saving Input Text


zancroft
12-15-2008, 05:23 PM
Is there anyway to save text from an input text field into a text file that can also be called upon at a later time?

matbury
12-15-2008, 05:57 PM
If you mean saving text in the user's browser cache, then yes, you can. You need to use SharedObject for that. SharedObjects are a more persistent form of cookies and they're a lot more useful. You can save any native AS 3.0 class directly as a SharedObject or serialise custom classes to be stored. Beware of file sizes though, the default maximum is 100KB, any more and the Flash Player will start up a dialogue box asking the user for more space (I'm assuming you don't want to store Shakespeare's sonnets though) This might freak some users out who are afraid of viruses even though SharedObject is perfectly safe. String objects are generally pretty small.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/SharedObject.html

Hope this helps! :)

zancroft
12-15-2008, 06:05 PM
The file is not going to go on the web. It will be for an interactive kiosk that the client wants to use to save information that will be later uploaded to another flash file. I would prefer it if it saved to a simple to read file like a text document.

matbury
12-15-2008, 06:17 PM
In that case, I'd recommend using Adobe AIR to create a desktop application. AIR has the ability to write files directly to the user's hard drive.

AIR is a free extension for Flash from Adobe: http://www.adobe.com/products/air/

It also requires that the Adobe AIR run-time environment is installed on the user's computer. It's pretty similar to Flash and uses ActionScript 3.0.

zancroft
12-15-2008, 06:40 PM
I've installed AIR, now how do I use it?

matbury
12-15-2008, 06:49 PM
Here's a tutorial on how to install the Flash CS3 extensions and start developing AIR apps: http://www.gotoandlearn.com/play?id=41

Also check out Adobe docs: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/

You'll see an AIR icon next to all the classes that are particular to AIR.

zancroft
12-16-2008, 02:40 PM
Kind of in the same vein, can a flash or air file read an already created text file and edit it? Such as add a new line of information or delete an old one. If so, how would I go about coding that?

matbury
12-17-2008, 11:05 PM
Yes, AIR can create, read and write local files. It can also interact with local databases. It's a pretty powerful tool. For more information and tutorials, I'd check out Adobe.com:

http://www.adobe.com/devnet/air/flash/

Happy coding! :)

Von2
12-23-2008, 08:07 AM
Hi,

Interesting! I knew that AIR is be able to capture text, but I have no idea how to.

At this moment I'm able to load a series of pictures that are automatically clustered on time. When clicking specifically on a picture, an enlarged version will be loaded in another scene and you are able to drag icons onto this picture, to draw and to type a text. Of course I want to be able to save those adaptations so that when reopening the picture as well the text as the icons and drawings will been visible. It would be nice if it is still possible to (re)drag, (re)draw and (re)type

Any idea how to do this. Thanks

runawayprisoner
12-25-2008, 05:01 PM
Hi,

Interesting! I knew that AIR is be able to capture text, but I have no idea how to.

At this moment I'm able to load a series of pictures that are automatically clustered on time. When clicking specifically on a picture, an enlarged version will be loaded in another scene and you are able to drag icons onto this picture, to draw and to type a text. Of course I want to be able to save those adaptations so that when reopening the picture as well the text as the icons and drawings will been visible. It would be nice if it is still possible to (re)drag, (re)draw and (re)type

Any idea how to do this. Thanks

You should convert them into a binary format of your choice... or create your own binary format.

As for the rest, it's just a matter of writing and reading from FileStream. If you are familiar with ByteArray, this is not a problem at all. FileStream acts exactly as ByteArray does.

Von2
12-27-2008, 08:50 AM
Thanks for your reply, but I have no idea what Filestream or ByteArray is. I've googled it, but I since i'm not working with classes I do not have a clue how to continue.