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:
On a button to increase score:Code:onLoad() { my_var = SharedObject.getLocal("save_file"); gamescore = 0; } onEnterFrame() { score.text = _root.gamescore; }
On a save button which seems to work somewhat:Code:onSelfEvent (press) { _root.gamescore += 1; }
On the load button:Code:onSelfEvent (press) { my_var.data.gamescore = _root.gamescore; }
Then there is a dynamic text box to display score...Code:onSelfEvent (press) { _root.score.text = ""; _root.gamescore = my_var.data.gamescore; }
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?




Reply With Quote