Author Topic: Problem with FlxSave when updating a game  (Read 1319 times)

Liaf

  • Member
  • **
  • Posts: 19
  • Karma: +0/-0
  • yay!
    • View Profile
Problem with FlxSave when updating a game
« on: Sun, Aug 1, 2010 »
I've recently uploaded my game on some portals, and got a comment which says there is a minor bug in my game (forgot to remove an event listener).
I've fixed it, but now I'm not sure if I should update my game on the portals, because of the loss of the data. Uploading a new game would mean that FlxSave would save/load the data from another location, and so all players who already played my game would lose their saves.

Is there any way I can upload a new way without all players losing their data?

paala

  • Contributor
  • ****
  • Posts: 250
  • Karma: +0/-1
    • View Profile
Re: Problem with FlxSave when updating a game
« Reply #1 on: Wed, Jul 25, 2012 »
I have the same problem here.
Did someone figured out how to upload a new swf (for fixing minor bugs), and the user to retain the save file?

auriplane

  • Snails!!
  • Contributor
  • ****
  • Posts: 497
  • Karma: +1/-0
  • Snails!!
    • View Profile
Re: Problem with FlxSave when updating a game
« Reply #2 on: Wed, Jul 25, 2012 »
Code: [Select]
        /**
         * Automatically creates or reconnects to locally saved data.
         *
         * @param   Name    The name of the object (should be the same each time to access old data).
         * @path    Name    The location of the save file.
         *
         * @return  Whether or not you successfully connected to the save data.
         */
        public function bind(Name:String, path:String="/"):Boolean
        {   
            destroy();
            name = Name;
            try
            {   
                _sharedObject = SharedObject.getLocal(name, path);
            }   
            catch(e:Error)
            {   
                FlxG.log("ERROR: There was a problem binding to\nthe shared object data from FlxSave.");
                destroy();
                return false;
            }   
            data = _sharedObject.data;
            return true;
        }   

This puts the save file in the root of that domain's save path, instead of relative to the SWF file's location.  This means it's consistent across server path changes.

If your old version DIDN'T do this, then this code will cause data loss.

paala

  • Contributor
  • ****
  • Posts: 250
  • Karma: +0/-1
    • View Profile
Re: Problem with FlxSave when updating a game
« Reply #3 on: Wed, Jul 25, 2012 »
Thank you auriplane!