Skip to main content
Inspiring
May 24, 2015
Answered

Save score

  • May 24, 2015
  • 1 reply
  • 238 views

I wonder how I could somehow save the highest score made in a given project.

I use the variable "score" for counting the points and a dynamic text named "textoscore.text =" "+ score.toString ();"

The goal would be getar the highest price in the game in the given device, and when being lost, save it, obviously.

But I've no idea how can I be performing such actions, someone could help me?

This topic has been closed for replies.
Correct answer kglad

if each player has their own high score, you can use the actionscript sharedobject:

// to display the highscore:

var so:SharedObject=SharedObject.getLocal("yourso","/");

if(so.data.highscore){

highscore_tf.text=so.data.highscore.toString();

} else {

// none recorded.

}

// at game's end:

if((so.data.highscore && score>do.data.highscore) || !so.data.highscore){

so.data.highscore=score;

so.flush();

}

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 24, 2015

if each player has their own high score, you can use the actionscript sharedobject:

// to display the highscore:

var so:SharedObject=SharedObject.getLocal("yourso","/");

if(so.data.highscore){

highscore_tf.text=so.data.highscore.toString();

} else {

// none recorded.

}

// at game's end:

if((so.data.highscore && score>do.data.highscore) || !so.data.highscore){

so.data.highscore=score;

so.flush();

}