Copy link to clipboard
Copied
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?
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();
}
Copy link to clipboard
Copied
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();
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now