I have simple code as3 with sharedobject. In this flash, I want to save name and score that writed by user. New name and score will show in the top, and the rest will follow under the new name and score. But I don't sure how to make it. I have dynamic text in next frame that will display the name and score.
stop();
var savedstuff:SharedObject = SharedObject.getLocal("myStuff");
btnSave.addEventListener(MouseEvent.CLICK, SaveData);
btnLoad.addEventListener(MouseEvent.CLICK, LoadData);
var cek:int = 0;
function SaveData(MouseEvent){
if (cek==0){
savedstuff.data.username = nameField.text
savedstuff.data.score = scoreField.text
savedstuff.data.username2 = "-";
savedstuff.data.score2="-";
cek=1;
}
else{
savedstuff.data.username2 = nameField.text
savedstuff.data.score2 = scoreField.text
}
savedstuff.flush(); // saves data on hard drive
}
function LoadData(MouseEvent){
nextFrame();
}
Hopeless with this code, can anybody help me?