-
Swish 1 - SharedObject
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?
-
incomplete information. Nothing you've shown demonstrates .so
Can't test so inside swishmax you have to export the swf before testing.
You might want to try the sz forums. when you do supply an swi so they can look under the hood.
http://forums.swishzone.com
-
not sure what else you need, there are like 4 objects in the .swi, heh.
I test in player exporting with SWF8 not inside swish itself.