Skip to main content
Inspiring
September 22, 2017
Question

Save and Load names in fields

  • September 22, 2017
  • 1 reply
  • 295 views

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);

}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
September 22, 2017

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.