A Flash Developer Resource Site

Results 1 to 20 of 20

Thread: Can someone recommend a Saving Info Example?

  1. #1
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51

    Can someone recommend a Saving Info Example?

    Can someone recommend a saving info example where variables could be passed out of a swf and saved into any type of file that is not web based? Like a text file or whatever, so long as the info can be passed to something on my hard drive. And of course a similar example that would allow retrieval of the variables back into the swf.

    Thanks in advance!

    Spit

  2. #2
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    I guess Im not clear..

    if the original .swf web based? or a standalone (like an .exe) or something?

    you can look into using a shared object which is like a Flash Cookie.. that can be 'saved' from the .swf to the local machine..and read back into the same .swf or another .swf on the same domain.

    there is a quick example of how it works in my footer.

  3. #3
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    The swf. file would not be a standalone .exe file...

    Which quick example should I look at in your footer?

    And if I wanted to eventually put it up on the internet would it work? or would I have to seriously alter it to make it work for internet use?

  4. #4
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    the link called shared object...

    and yes it works when the .swf is on-line..(web based).. and saves the cookie locally to the users computer.

  5. #5
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    Thanks for your help!

  6. #6
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51

    Talking

    WOW! This shared object example has opened up a whole new understanding of things I can do with Flash!

    I spent so much time learning php and data base stuff just to have flash be able to save thing like _x and _y coordinates of objects. Now I don't need to go through all the hours of scanning through the Flash, the php, and the database to figure out why something isn't saving. Until now I didn't think flash was able to save things in any easy way.

    I can't thank you enough!!!

  7. #7
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    well the php/DB stuff is good/better to learn because ultimately it gives you more control..


    while Shared Object has its place its by no means 'secure' or fool proof..

    I mean the user could delete it.. or even go read it.. so I wouldnt use it for sensitive data or anything..

    just like you would for a cookie.

  8. #8
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    well the php/DB stuff is good/better to learn because ultimately it gives you more control..


    while Shared Object has its place its by no means 'secure' or fool proof..

    I mean the user could delete it.. or even go read it.. so I wouldnt use it for sensitive data or anything..

    just like you would for a cookie.

  9. #9
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    I totally understand what you are saying about the security issues, and agree.

    I am curious however to know how is it possible to access this shared object after the .swf creates it in the folder that it resides?

    I understand how to find in on line as a cookie, but where is the file that this info is being sent to in the folder when I run the .swf just on my computer? I have the "show hidden files" option checked in my folder options section for that folder, but I still only see the .fla and .swf.

    Thanks Again!

    Spit

  10. #10
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    C:\Documents and Settings\userName-Account\Application Data\Macromedia\Flash Player\#SharedObjects

  11. #11
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    Very cool! Again Thanks!

  12. #12
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51

    Directing the location of the save file...

    I totally understand how this Shared Object concept works, and what I am wondering now is... is there a way to direct the saving of this shared object file to a specific folder using action script?

    Thanks again!

    Spit

  13. #13
    Senior Member whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    what do you mean? like save it to a folder on the desktop or something?

    no, at least not that I know of.

    I dont understand why you would want to though? what is it you want to do?

    it can only be read by the .swf or another .swf on the same domain..

  14. #14
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93
    php isnt that secure either... just skip all the mumbo jumbo and do Ajax or jsp

  15. #15
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    The reason I'm asking is I'm teaching a basic flash game making course this summer and I want the students to be able to save variables locally on there computer.

    Using this shared object is really easy way to do that, and I wanted them to be able to direct where the object is being saved to. This way they could keep a variable like a high score in the same folder as the swf they create, so that when they want to take there game home with them and move it to another computer all they need to do is move the folder all as one with this shared object in it.

  16. #16
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93
    Quote Originally Posted by SpitSpitSpitty View Post
    The reason I'm asking is I'm teaching a basic flash game making course this summer and I want the students to be able to save variables locally on there computer.

    Using this shared object is really easy way to do that, and I wanted them to be able to direct where the object is being saved to. This way they could keep a variable like a high score in the same folder as the swf they create, so that when they want to take there game home with them and move it to another computer all they need to do is move the folder all as one with this shared object in it.
    while if this was a client only game i wouldnt care. but the moment you make it a pool of students saving their collective score you would need to store it to the database. It will get you by imo... but i would look at server side stuff for a more interactive experience.

    good luck!

  17. #17
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    Quote Originally Posted by rrutter81 View Post
    while if this was a client only game i wouldnt care. but the moment you make it a pool of students saving their collective score you would need to store it to the database. It will get you by imo... but i would look at server side stuff for a more interactive experience.

    good luck!
    There not going to be saving a collective score, a high score is just one example of something they might save in there game. Any game a student saves will not be connected in any way with another students game, the variables saved will just be for that game the student is developing and will not be posted on a web site.

  18. #18
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93
    Quote Originally Posted by SpitSpitSpitty View Post
    There not going to be saving a collective score, a high score is just one example of something they might save in there game. Any game a student saves will not be connected in any way with another students game, the variables saved will just be for that game the student is developing and will not be posted on a web site.
    then its just fine

  19. #19
    Spit
    Join Date
    Oct 2008
    Location
    Philly, PA
    Posts
    51
    OK, thank you for clearing that up. However, do you know a way I can direct where this shared object will be saved to? Is there a way to specify the folder I want it to go in?

  20. #20
    Member
    Join Date
    Jul 2000
    Location
    Atlanta
    Posts
    93
    Quote Originally Posted by SpitSpitSpitty View Post
    OK, thank you for clearing that up. However, do you know a way I can direct where this shared object will be saved to? Is there a way to specify the folder I want it to go in?
    ill be honest with you buddy, ive only worked with server side storage, not local....

Tags for this Thread

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