Click to See Complete Forum and Search --> : Saving files with flash


Sup3rkirby
11-02-2006, 01:46 PM
Well, this is actually a two part question, but it saves time(and space) if i post once.

First of all. Can you save files on a server(and edit them)(and the server is local to the flash object). I know with languages like ASP and such, you can do this, but I was wondering if flash was able to do this as well.


Also, is there anyway to integrate flash and HTML(/js)? For instance, you have a js variable that has "Michael Jackson" in it and you want to have flash use that var. Or you have something input into a flash document and need to use if for a script(js) in your webpage. Is there a direct way, or can you write a hidden div that contains the data and then read it with the other?(but a direct way would be best because of arrays, etc.)

abeall
11-02-2006, 08:35 PM
1. No, you can't save files with Flash in this way. The absolute most you can do is used SharedObject to save local information(basically like a cookie). Normally to save a file, you pass your information to a server side script and let that do the saving. You use LoadVars to send the data to a script.

2. If you use Flash 8 or higher, you use the ExternalInterface class to communicate between SWF and JS. It works quite nicely, but it requires Flash 8 to be used. For FLash 7 or below, there are older ways to communicate, but they aren't as reliable. The simplest way to go from SWF to JS is to call a JS function from AS with the getURL() method:

getURL('javascript:myFunction()');

This is fairly reliable. But going from JS to SWF(ie sending a JS variable into Flash) is not easy or reliable, and there are several options, do some searching for this if you feel like being confused. :)