Chances are you'll have to gain information from users of your application for one reason or another whether it is a contact form or an interactive game. This means you'll have to create a form of some sort, in this tutorial we'll go through the process of creating 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.
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. INPUT is a property of the TextFieldType class.
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.
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.
textInput.type = TextFieldType.INPUT;
textInput.border = true;
textInput.height = 20;
textInput.x = 100;
textInput.y = 100;
addChild(textInput);
This post is tagged Actionscript 3, Add new tag, AS3 Guide, Dynamic Input Fields
Share This Post
Jobs


























3 Comments
nice easy tutorial
How would i get the text inputted from the user, on the next frame?
Real nice, very clean. Some kind of advanced tut right after this would be good though. Saving the input, importing it into dynamic text boxes later, changing border color etc.
Incoming Links
Leave a Reply