Hey, I have a problem.
We are designing a game for an exhibition and we’re having problems saving data. We want to have a highscore that saves name and score in to an Shared Object.
I can now save and load the name and the score to the Shared Object, but when I start a new game the old data is erased. How should I do to be able to save it like this in the Shared Object:
name1 score1
name2 score2
?
This is what I got so far (just to save and load the Shared Object):
//in the top of the document
var so:SharedObject = SharedObject.getLocal("userHighScore");
//so.data.highScore = 0; // För att resetta Shared Object
//so.flush();
if (so.data.highScore != null){
highscorenr.text = so.data.highScore;
highscorename.text = so.data.highScoreName;
}
//when the game is done
var so:SharedObject = SharedObject.getLocal("userHighScore");
so.data.highScore = scorenr;
so.data.highScoreName = highscorename.text;
so.flush();
highscorenr.text = so.data.highScore;
highscorename.text = so.data.highScoreName;
If you post any code, please comment it so that I can fully understand it.
Thanks