Copy link to clipboard
Copied
I'm trying to get the user to type a random name in a field (text1.text) converted as input, causing it to be saved immediately, and after a new input is loaded.
But it's not working, could anyone help me?
stop();
// text1 = text input name
var nickName:String;
var so:SharedObject = SharedObject.getLocal("inputtext", "/");
so.data.inputtext = text1.text;
so.flush();
if(so.data.inputtext){
nickName = String(text1.text);
text1.text = so.data.input;
} else {
nickName = String(text1.text);
}
Copy link to clipboard
Copied
that code doesn't make sense.
is text1.text defined (and what you expect) before that code executes?
if so, there's no point to that if-statement.
if not, the if-statement should executed before assigning so.data.inputtext and you should be using a listener to assign so.data.inputtext.