Highscore load and save problem
I keep score with this script
package {
public class ScoreHolder {
static public var score:Number = 0;
var sharedHigscore:SharedObject;
sharedHigscore = SharedObject.getLocal("Scoretop");
if(sharedHigscore.data.highScore == null){ //if it is being called for the first time it will be null. so change it to 0.
sharedHigscore.data.highScore = 0;
}
{
score += 1;
if(score > sharedHigscore.data.highScore){
//if score greater than highscore then set highscore = score and save it.
sharedHigscore.data.highScore = score;
sharedHigscore.flush();
}
}
}
Code for frame
import ScoreHolder;
...............
...............
else if (aComplete)
{
ScoreHolder.score += 10;
sc_1.text = ScoreHolder.score.toString();
txtHighScore.text = String(sharedHigscore.data.highScore);
gotoAndPlay(136);//LEVEL 2
}
Score counter work perfectly but high score is not.
