How to create Flash Dynamic Input Fields

April 14, 2010

How To

  • We will  Create dynamic text fields inside Actionscript.
  • We first create a new TextField object that’ll give us access to all the properties, methods and events of the TextFields class.
  • We’ll call this TextField object textInput.

var textInput:TextField = new TextField();textInput.type = TextFieldType.INPUT;

textInput.border = true;

textInput.height = 20;

textInput.x = 100;

textInput.y = 100;

addChild(textInput);

  • We want to make sure that the user can input data into the text field, to do this we simply set the type property to INPUT.
  • NPUT is a property of the TextFieldType class.

var textInput:TextField = new TextField(); textInput.type = TextFieldType.INPUT;

textInput.border = true;

textInput.height = 20;

textInput.x = 100;

textInput.y = 100;

addChild(textInput);

  • Setting the border property to true gives the text field an outline.

var textInput:TextField = new TextField(); textInput.type = TextFieldType.INPUT;

textInput.border = true;

textInput.height = 20;

textInput.x = 100;

textInput.y = 100;

addChild(textInput);

  • We set the height property to 20px and change the position of the text field on the stage to 100px.
  • Finally using the addChild() method we add the text field to the display list.

var textInput:TextField = new TextField(); textInput.type = TextFieldType.INPUT;

textInput.border = true;

textInput.height = 20;

textInput.x = 100;

textInput.y = 100;

addChild(textInput);

, , ,

Subscribe

Subscribe to our e-mail newsletter to receive updates.

No comments yet.

Leave a Reply