Welcome Guest Search | Active Topics | Members

Save and Load Variables [Advanced] Options
jjiskooler
Posted: Thursday, July 15, 2004 5:44:51 AM
Rank: Newbie

Joined: 7/6/2004
Posts: 5
This tutorial will teach you how to make text be saved and loaded.


Save and Load Functions

Open the main timeline actions. Create a function called "setCookie(c, n, v)" (c = Cookie, n = Name, v = Variable). Under that put "var so = SharedObject.getLocal(c);". Then under that put "so.data[n] = v;". Finally under that put "so.flush();".

So far it should look like this:

function setCookie(c,n,v) {
var so = SharedObject.getLocal();
so.data[n] = v;
so.flush();
};

Now make another function called "getCookie(c,n)" (c = Cookie, n = Name). Under that assign "var so = SharedObject.getLocal();". Then under that put "return so.data[n];".

The functions should look like this:

function setCookie(c,n,v) {
var so = SharedObject.getLocal(c);
so.data[n] = v;
so.flush();
};
function getCookie(c,n) {
var so = SharedObject.getLocal(c);
return so.data[n];
};

Make a input text field called "text". Make a save button and a load button.

In the save button actions put:

on (release) {
_root.setCookie("vars","text",_root.text);
}

In the load button actions put:

on (release) {
_root.text = _root.getCookie("vars","text");
}

If this is done right it will save the text you type and load the text that was type last time text was saved.



If you have any questions about this tutorial or any other flash related question email me at sk8r831@yahoo.com and I'll get back to you as soon as possible.


Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.