-
[ HELP ] How to make basic Save/Load system?
Hey Flashkit , how to make basic load/save system?
-
Originally Posted by CrazY.
Hey Flashkit , how to make basic load/save system?
On stage:
1- You need to create two text fields; one as an Input text field (give it an instance name e.g. saveText) and the other as a Dynamic text field (give an instance name e.g. loadText).
2- Create three buttons and give each one an instance e.g. saveBtn , loadBtn , clearBtn
3- On the first frame on stage, paste the following code:
_root.saveText.text = "";
_root.loadText.text = "";
//
Info = SharedObject.getLocal("saveData");
//
_root.saveBtn.onRelease = function() {
//Save Data.
Info.data.center = _root.saveText.text;
};
//
_root.loadBtn.onRelease = function() {
//Load Data.
if (Info.data.center == undefined) {
_root.loadText.text = "";
} else {
_root.loadText.text = Info.data.center;
}
};
//
_root.clearBtn.onRelease = function() {
//Clear Data.
Info.data.center = undefined;
_root.saveText.text = "";
_root.loadText.text = "";
};
4- Test the file.
In the input text field write any text or number you like then press save. Now if you press the load button the text you entered in the input text field will be loaded in the dynamic text field. Pressing clear button will clear the data from the memory.
-
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|