Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Save score

Explorer ,
May 23, 2015 May 23, 2015

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?

TOPICS
ActionScript
217
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 23, 2015 May 23, 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();

}

Translate
Community Expert ,
May 23, 2015 May 23, 2015
LATEST

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();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines