VCA224 Multimedia 2

Exercise: Input/Output Text

One of the cool tools you can use in Flash is input text—that is, text that is input by the user as the program is running. This information is stored as one or more variables that can be accessed later by the program and used in a variety of ways. In this simple exercise, you will create a swf file that asks for the user's name, then displays it in a greeting.

Specifications

Procedure

  1. Open a new Flash document.
  2. Draw a text box; choose static text. In the text box, write "What is your name?" You can choose whichever font face, color & size you prefer.
  3. Below the static text box draw another text box. Change this one to input text. Give it the variable ("var") name inputText. Note that this variable name is arbitrary; I could have called it just about anything, even fred, but inputText is more descriptive.
  4. Put a button on the page (make a shape, convert it to a button symbol).
  5. On the button, add the following action:
  6. on (release) {
    gotoAndStop(2);

    }

  7. Create a new layer for actions. Click on the keyframe in this new layer and open the actions window. Add a stop();
  8. Add blank keyframes to both layers in frame 2.
  9. In the non-actions layer, add a new text box. Make this one a dynamic text field. Give it the variable name outputText. Set the font face, color and size to your preference.
  10. Put a button on this page (you could use the same one). On the button put:
  11. on (release) {
    gotoAndStop(1);

    }

  12. In the actions layer in frame 2, add the following script:
  13. stop();

    outputText = "Hello there, "+inputText+"!"

  14. Try it out.
  15. Important: When you use either input or dynamic text fields in a Flash movie, you should embed the font you specified for use in those fields. To do this, click on the field(s), and press the "embed" button. Choose whichever character sets you think you'll need (usually upper case, lower case, numbers, punctuation & basic Latin).
  16. Export a .swf. Turn-in both .swf and .fla files.

Go Above and Beyond

Some possibilities:

Point Breakdown

10 pts

Went above & beyond and made something special

9 pts

Above and beyond the basics.

8 pts

Did the basics; it works, but it's nothing fancy.

7 pts

Something's not working right.

0-6 pts

Poor showing; mostly incomplete or full of errors.

 

Course Outline

Syllabus

Student Resources