• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

file work

Participant ,
Jul 12, 2011 Jul 12, 2011

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?

TOPICS
ActionScript

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 12, 2011 Jul 12, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 12, 2011 Jul 12, 2011

Copy link to clipboard

Copied

but if I want to write it to the user's computer is that possible?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 12, 2011 Jul 12, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2011 Jul 12, 2011

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 12, 2011 Jul 12, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 12, 2011 Jul 12, 2011

Copy link to clipboard

Copied

use the sharedobject.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 12, 2011 Jul 12, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 12, 2011 Jul 12, 2011

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 16, 2011 Aug 16, 2011

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2011 Aug 16, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 20, 2012 Mar 20, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 20, 2012 Mar 20, 2012

Copy link to clipboard

Copied

LATEST

that's your prerogative.

good luck in the future.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2011 Jul 12, 2011

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/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 12, 2011 Jul 12, 2011

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines