Setting a Field's Maximum Length : Length « TextField « Flash / Flex / ActionScript






Setting a Field's Maximum Length

 

package {

  import flash.display.Sprite;
  import flash.text.TextField;
  public class Main extends Sprite {
    public function Main(  ) {
      var field:TextField = new TextField(  );
      field.type = flash.text.TextFieldType.INPUT;
      field.border = true;
      field.background = true; 
      field.maxChars = 6;  // maximum of 6 characters can be input
      addChild(field);
    }
  }
}

        








Related examples in the same category