A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Flash writing to text file

  1. #1
    Junior Member
    Join Date
    Dec 2000
    Posts
    17
    hey does anyone know if flash can write a text file like it can read from one?

    i'm creating a stand alone exe where I want the user to enter varibles that can be retrieved the next time the exe is launched. is it only possible through the web and a data base?

    thanks

  2. #2
    Junior Member
    Join Date
    Aug 2000
    Location
    Denver, CO
    Posts
    25

    used to be able to

    You used to be able to write to a text file when u were creating a standalone flash exe using the somewhat hidden FsCommand 'SAVE'. From what Ive heard they have removed that feature for security reasons though if its true thats a big blow to the standalone flash app. I dont know if they added a new feature to replace it and would be very interested in any information anyone has concerning it.

  3. #3
    The Flashman earl223's Avatar
    Join Date
    Sep 2000
    Location
    Marikina City, Philippines
    Posts
    876
    You can use MX's SharedObjects. You can try to search for some topics on this. But to give you some background...

    SharedObjects allows your movie, whether on the web or as a standalone projector, to save data onto your local harddrive. SharedObjects act like cookies but as they say, these guys are more powerful than cookies.

    SharedObjects can store any variable you want; from username, user preference options, highscores, arrays, XML objects, etc. It's kinda cool!

    To create a SharedObject, just type in the following script:
    Code:
    VariableName = SharedObject.getLocal("filename")
    
    -eg-
    
    myObject = SharedObject.getLocal("Game_Data")
    This line of code creates a SharedObject file (if it does not exist), or opens the file named (if it exists) called Game_Data.sol. The file is located on your local drive (usually under C:\Windows\Application Data\Macromedia\Flash\Players\.....).

    After creating or opening the file you can save data into it by saying:
    Code:
    myObject.data.Username = UserName.text;
    This line of code creates a variable inside your SharedOject and assigns it the value of UserName.

    If you want to retrieve data, just do the opposite:
    Code:
    UserName.text = myObject.data.Username;
    This line gets the value of Username from the SharedObject and assigns it into a textbox.

    SharedObjects are cool and fun to use. They give new meaning to loading and saving movie information. Adios TextFiles!!! =)





  4. #4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center