A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: HELP trouble doing a .swf file

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    HELP trouble doing a .swf file

    I am nearly done with a new game that I am making using that cool .exe feature of 3dfa. I can not find anyway to allow my users to save there game. I have about 15 varables that need to be saved in order for the game to be saved. I don't know a way to do this on a .exe file running on someones computer since there is no database. I would like this to be saved to some type of txt file. Any help would be appreciated.
    I am totally lost on this idea.

    Thanks
    Carl

  2. #2
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    This is an undocumented feature, but certainly something worth mentioning in the help file ...

    string = "my string"
    string.save ("filename")
    string.load ("filename")
    Cheers,
    kusco
    (3DFA Support Team)

  3. #3
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    Thank you this is awsome

    Thank you so much for your help. This makes my job easy. this is one of the coolest features that is undocumented. I have been trying stuff the hard way for a long time.


  4. #4
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    more help needed

    Ok I am able to get a file to save. but I can not get the string to load back in. I am not sure how that will work. ?

    also is there a way to save multiple files from one .exe ?

  5. #5
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    474
    Quote Originally Posted by kusco
    This is an undocumented feature, but certainly something worth mentioning in the help file ...

    string = "my string"
    string.save ("filename")
    string.load ("filename")
    Uh...wha....o.O.....is this new? Because this is INSANELY AWESOME USEFUL CRAZY!!!

    Anywho, on to your question. To load the varibles just do...

    myvar.load ("filename")

    myvar will now be equal to whatever the text was in the file.


    To save multiple files just change the names.

    myvar1="hello"
    myvar2="bye"

    myvar1.save ("save1")
    myvar2.save ("save2")

    You could also combine the strings then save the variables and when you load it just seperate each varible with some string functions. If you would like to see an example of that I can make one.
    BC

  6. #6
    Junior Member
    Join Date
    Mar 2006
    Posts
    19

    Duhh i am feeling stupid

    i can get anything to save but nothing will load. I have done the exact scripts using the same variable myvar1 and 2 and nothing is re loading.

    I don't get it?

    any ideas???

  7. #7
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    You MUST declare the loading variable to be a string first.

    loadme = new String;
    loadme.load ("filename.any_extension");
    trace (loadme);

    In the next release, there will be a function called fileLoadString that will allow you to load a string into an undeclared variable.

    loadme = fileLoadString ("filename.any_extension");
    trace (loadme);

    There will also be a function called fileLoad("filename"). You will love this function. It will allow you to save and load objects and arrays to the local drive.

    object1 = new Object;
    object1.a = 13;
    object1.b = 17;
    object1.save ("myObject.object");

    object2 = fileLoad ("myObject.object");
    trace (object2.a);
    trace (object2.b);

    The object MUST use the .object extension otherwise fileLoad won't know what type of data to expect. Likewise, arrays must be saved using the .array extension.

    array1 = new Array (131, 174);
    array1.save ("myArray.array");

    array2 = fileLoad ("myArray.array");
    trace (array2[0]);
    trace (array2[1]);

    The array can be a multidimensional array containing objects. Likewise, an object can contain arrays, and this kind of data tree can traverse to any depth.

    These features already exist but were not made publicly available because they cannot be used in Flash animations. However, .exe projects should be allowed to do anything.

    Another useful undocumented feature is using 'debug' instead of 'trace'. Debug does not require brackets.

    trace (any_kind_of_expression) is the same as
    debug any_kind_of_expression
    Last edited by kusco; 03-07-2007 at 06:28 PM.
    Cheers,
    kusco
    (3DFA Support Team)

  8. #8
    Senior Member sadako232's Avatar
    Join Date
    Mar 2006
    Posts
    153
    You could also combine the strings then save the variables and when you load it just seperate each varible with some string functions. If you would like to see an example of that I can make one.

    Could you please make that example?

  9. #9
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    474
    Here is a pretty simple example.
    Attached Files Attached Files
    BC

  10. #10
    Senior Member sadako232's Avatar
    Join Date
    Mar 2006
    Posts
    153
    Works great, Danke!

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