# Shared objects help! highscore

**URL:** <https://forum.kirupa.com/t/shared-objects-help-highscore/241107>\
**Category:** Uncategorized\
**Created:** [October 10, 2007, 2:56am UTC](https://forum.kirupa.com/t/shared-objects-help-highscore/241107 "2007-10-10T02:56:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vin23leo](https://avatars.discourse-cdn.com/v4/letter/v/b77776/32.png) [@vin23leo](https://forum.kirupa.com/u/vin23leo)\
**Post date:** [October 10, 2007, 2:56am UTC](https://forum.kirupa.com/t/shared-objects-help-highscore/241107/1 "2007-10-10T02:56:29Z")

</div>

hey guys i need help i have a game which is based on the time you reach home, kind of game i have the highscore in a shared object the highscore works, the only problem is, for example if the highscores are  
1st = 8  
2nd = 13  
3rd = 15  
and then you get a score of 20 the highscore shows  
1st = 13  
2nd = 15  
3rd = 20  
for some reason it pushes everything up, so you lose the last highscore, if you get a crap score

here is the code:

stop();  
scorefin = SharedObject.getLocal(“highscores”);  
var thescore = \_global.finalScoreShiftAsNumber;  
var thetimer = \_global.finaltimeasnumber;  
if (timer1 == undefined) {  
score.data.timer1 = 0;  
timer1 = 0;  
}  
if (timer2 == undefined) {  
score.data.timer2 = 0;  
timer2 = 0;  
}  
if (timer3 == undefined) {  
score.data.timer3 = 0;  
timer3 = 0;  
}  
if (thetimer\>parseInt(timer1)) {  
scorefin.data.timer3 = scorefin.data.timer2;  
scorefin.data.timer2 = scorefin.data.timer1;  
scorefin.data.timer1 = thetimer;  
scorefin.data.score3 = scorefin.data.score2;  
scorefin.data.score2 = scorefin.data.score1;  
scorefin.data.score1 = thescore;  
} else if (thetimer == parseInt(timer1) || thetimer\>parseInt(timer2)) {  
scorefin.data.timer3 = scorefin.data.timer2;  
scorefin.data.timer2 = thetimer;  
scorefin.data.score3 = scorefin.data.score2;  
scorefin.data.score2 = thescore;

} else if (thetimer == parseInt(timer3) || thetimer\>parseInt(timer3)) {  
scorefin.data.timer3 = thetimer;  
scorefin.data.score3 = thescore;  
} else {  
trace(“nothing”);  
}  
var scoreArr:Array = new Array(scorefin.data.timer1, scorefin.data.timer2, scorefin.data.timer3);  
scoreArr.sort(Array.NUMERIC);  
//  
timer1\_txt.text = scoreArr[0];  
timer2\_txt.text = scoreArr[1];  
timer3\_txt.text = scoreArr[2];  
score1\_txt.text = scorefin.data.score1;  
score2\_txt.text = scorefin.data.score2;  
score3\_txt.text = scorefin.data.score3;

the game is based on time fastest reached, can you anyone see wats wrong with my code, i really need help as this project is due soon for school and i need to demonstrate it.  
much appreciated  
cheers…
