1 Reply Latest reply on Jan 29, 2009 9:17 AM by Joe ... Ward

    User Alias

    fypstudent
      Hi,
      I wanted to create an user alias where users are able to change their nickname easily. I had created an input box for users to enter their name. However, when I restart the application again, the name is not stored. How do I go about storing the information/value users had entered?

      Codes:

      //////////userAlias.as////////////////////////

      package {

      import flash.display.Sprite;
      import flash.display.Stage;
      import flash.text.*;
      import flash.events.*;

      public class userAlias extends Sprite{

      private var myTextBox:TextField = new TextField();
      private var myText:String = "Type your text here.";

      public function userAlias() {

      myTextBox.type = TextFieldType.INPUT;
      myTextBox.background = true;
      myTextBox.height = 14;
      myTextBox.width = 93;

      var format:TextFormat = new TextFormat();
      format.font = "Arial";

      format.size = 9;

      myTextBox.defaultTextFormat = format;

      addChild(myTextBox);
      myTextBox.text = myText;
      }
      }
      }
        • 1. Re: User Alias
          Joe ... Ward Level 4
          For something simple like this, the flash.net.SharedObject class provides an easy way save a value. You will have to add an event listener to detect when the value is changed so that you can call a routine to save a new value. And, of course, need to read that value when your application starts up.

          You can also save data in a file, store data in a local database, or use the encrypted local store.