Using Input Text boxes - 1

In this tutorial you will create a simple application that accepts text input via an Input Box. On clicking a button, the text will be transferred across to a Dynamic Text box. Although this application doesn't do anything spectacular, it introduces a few key concepts in Actionscripting that you will be able to use later to make interesting and powerful applications.

  1. Open Flash and create a new movie.

  2. Select the Text Tool and draw a text box on the stage. Open the Properties Inspector and change the Text Type to ‘Input Text’, and the Instance Name to ‘myText’. You should also select the option to 'Show border around text' so that the text box shows up against the background.

  3. Draw another text box on the stage, and change its properties so that the Text Type is ‘Dynamic Text’ and its Instance Name is ‘newText’. You should also select the option to 'Show border around text' so that the text box shows up against the background.

  4. Next, create a button and place it on the stage. Arrange the text boxes and button as per the diagram below.

  5. Attach the following Actionscript to the button instance:
    on (release){
    	newText.text=myText.text;
    }
    
  6. Test your application, type some text into the Input Text box, click the Transfer button and Hey Presto! the text is copied across to the Dynamic Text box.

    Try it for yourself, below:-

Additional things to try

  1. Limit the number of characters that the user can input by setting the 'Maximum Characters Allowed'.

  2. Add some code to clear the Input Text box automatically when the button is pressed.