Skip to main content
Inspiring
August 8, 2013
Answered

Some help with an input text field

  • August 8, 2013
  • 1 reply
  • 447 views

Hi there,

Just one simple question...

How can I change the font and size of an input text field added to the stage by code:

var txt_inp:TextField = new TextField();

txt_inp.x = 500;                  

txt_inp.y = 300;

txt_inp.width = 500;

txt_inp.height = 50;

txt_inp.restrict = "0-9 a-z A-Z";

txt_inp.maxChars = 28;

var myText:String = "Type your name here."

function captureText():void

        {

            txt_inp.type = TextFieldType.INPUT;

            txt_inp.background = true;

            addChild(txt_inp);

            txt_inp.text = myText;

            txt_inp.addEventListener(TextEvent.TEXT_INPUT, textInputCapture);

        }

Thanks!!!!!

This topic has been closed for replies.
Correct answer SirMarley

I got it:

var format:TextFormat = new TextFormat();

format.font = "CooperBlack";

format.size = 20;

txt_inp.defaultTextFormat = format;

1 reply

SirMarleyAuthorCorrect answer
Inspiring
August 8, 2013

I got it:

var format:TextFormat = new TextFormat();

format.font = "CooperBlack";

format.size = 20;

txt_inp.defaultTextFormat = format;