Game Development Reference
2. Save the I]ej*]o file and test the program. You should now see a much more easy-to-use
input text field with a gray background and a blinking cursor, as shown in Figure 5-12.
Figure 5-12. The input text field has a gray background and
a blinking cursor. It prevents letters from being entered.
3. Try entering some text other than numbers. Ha! You can't do it, can you?
Text field objects belong to AS3.0's PatpBeah` class. You can actually create text fields out of pure
code as long as you import the PatpBeah` class into your program, along with your other import
directives, like this:
The PatpBeah` class is part of Flash's patp package, which contains many useful text-related classes.
To import all the classes of a given package, use an asterisk instead of a specific class name. With all
classes in the patp package imported, you can create a text field object and then display, size, format,
and position it on the stage. All it takes are a few lines of code in your constructor or ejep method
that might look something like this:
Interesting! But you didn't do this in the program. Instead, you used Flash's drawing tools to create,
format, and position the text fields; Flash automatically imported all the classes in the patp package
in the background. This is great because it means that the input and output text fields can use all the
formatting options available to these classes. In fact, all the options you assigned the text fields in