Copy link to clipboard
Copied
How does one actually go about writing a file out to a directory from inside a class or is there an actual class that handles that like in other languages?
Copy link to clipboard
Copied
if you're using adobe air, you can use the file class.
otherwise, you'll use the urlloader class to call a server-side executable (eg, a php file) that will write the file to your server.
Copy link to clipboard
Copied
but if I want to write it to the user's computer is that possible?
Copy link to clipboard
Copied
What I want to do is save the XML information that I built to an XML file on the user's computer so that it is specific to that user.
Copy link to clipboard
Copied
You can ALLOW USER save it with FileReference. Other wise, unless it is an air application - you cannot save anything on user's harddrive without him being aware that it was saved. SharedObject is, of course, an exception but it is a slippery road because user can always reject/remove this info.
How are you going to reuse this saved file if ever?
Copy link to clipboard
Copied
It will be the way for the site to access the information concerning their particular dragon each time they log on. That way the information can be concerning their particular dragon and I do not have to keep a large amount of information on the server for each member.
Copy link to clipboard
Copied
use the sharedobject.
Copy link to clipboard
Copied
It is nice of you to say that, but could you explain a bit about it. I have tried to understand it but I seem to find it rather confusing.
Copy link to clipboard
Copied
var so:SharedObject = SharedObject.getLocal("yourso");
if(so.data.whatevervariable){
// use so.data.whatevervariable etc
}
// some place when you have the data that's needed to be saved:
so.data.whatevervariable=thedata;
Copy link to clipboard
Copied
But then you have to flush() it, right in order for it to actually be written to the SharedObjects area on their hard drive?
Copy link to clipboard
Copied
no, you don't have to apply the flush() method to write to your so. if you apply flush(), data is written to the so immediately. if don't apply flush(), data is written when your swf closes.
p.s. i notice you marked many of your threads as answered but gave noone credit for giving a helpful or correct response. if someone gives a helpful/correct response, you should mark their response.
Copy link to clipboard
Copied
Just so taht you know, many of the items I marked as answered were because I got them answered by doing a lot of research elsewhere and finally coming up with the answer. I gave credit where credit was due.
Copy link to clipboard
Copied
that's your prerogative.
good luck in the future.
Copy link to clipboard
Copied
Here is documentation for SharedObject:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/SharedObject.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
Also there are tons of tutorials on Internet on how to use it. Here is the first one that comes on Google:
http://www.flashdaweb.com/2008/01/tutorial-actionscript-3-using-shared-objects-to-show-the-time-of-page-browsing/
Copy link to clipboard
Copied
Also you can enable user to save file on their local hard drive via using FileReference class. This though doesn't have any access to file structure - it behaves exactly like when you save, say, image from a web page with OS' interfaces etc.