Hey All,
Finally figured out how to use sharedobject in swish, but now I am having a trouble loading the variables I save...
On the Scene:
Code:
onLoad() {
my_var = SharedObject.getLocal("save_file");
gamescore = 0;
}
onEnterFrame() {
score.text = _root.gamescore;
}
On a button to increase score:
Code:
onSelfEvent (press) {
_root.gamescore += 1;
}
On a save button which seems to work somewhat:
Code:
onSelfEvent (press) {
my_var.data.gamescore = _root.gamescore;
}
On the load button:
Code:
onSelfEvent (press) {
_root.score.text = "";
_root.gamescore = my_var.data.gamescore;
}
Then there is a dynamic text box to display score...
Basically, I increase score a few times up to lets say, 5. I click save. Then I close the program. I open the program, click load and the textbox displays "undefined" for the score, instead of loading it. Any ideas why?