FlxSave for html5 - Working locally, but won't work when my game is played online

84 views
Skip to first unread message

Gen

unread,
Feb 23, 2016, 8:33:58 AM2/23/16
to haxef...@googlegroups.com
Hey Haxeflixel,

Here's the process I follow when saving my game:
1. private var saveObj:FlxSave = new FlxSave();
2. saveObj.bind("MyGameSave1");
3. saveObj.data.varToSave = "bla";
4. saveObj.flush();

I repeat steps 3 and 4 every game loop (30 times a second, probably overkill, but didn't cause any significant delay in testing).  

This all works fine when I test it locally, but when I upload my game to newgrounds/kongregate, no stored data is recovered when i refresh and the game simply starts anew.  Has anyone else encountered a similar problem? 

I'm using flixel 4.0

Thanks in advance.

EDIT: Updated example code to clarify that i am not recreating the flxsave object every frame.

Gama11

unread,
Feb 23, 2016, 11:19:43 AM2/23/16
to HaxeFlixel
If there's an issue, it's probably with OpenFL's SharedObject. FlxSave is just a wrapper around that.

And yeah, it would be much nicer to keep a reference to a bound FlxSave object in a member variable instead of creating a new object every frame.


On Tuesday, February 23, 2016 at 2:33:58 PM UTC+1, Gen wrote:
Hey Haxeflixel,

Here's the process I follow when saving my game:
var saveObj:FlxSave = new FlxSave();
saveObj.bind("MyGameSave1");
saveObj.data.varToSave = "bla";
saveObj.flush();

I repeat this process every game loop (30 times a second, probably overkill, but didn't cause any significant delay in testing).  

Gen

unread,
Feb 24, 2016, 1:13:10 PM2/24/16
to haxef...@googlegroups.com
Indeed, the problem was with OpenFL's SharedObject, data was being saved to a temporary location.
Reply all
Reply to author
Forward
0 new messages