Game Development Reference
In-Depth Information
8. Finally, and very importantly, you need to give the text field an instance name. Without one,
you can't target it with code in the program. Make sure that the text field is still selected and
enter the name output in the Instance name box at the top of the Properties panel. Don't forget
this step; otherwise the game won't work.
The ActionScript editor window provides text object code hinting if you add _txt to
the end of any text object names. If you give the dynamic text field the instance name
output_txt , code hinting will be activated for this object, which might be helpful when
you start entering your code in the editor.
Adding input text
You'll add the input text field just below the dynamic text field you created in the previous steps:
1. Make sure that the dynamic text field you just created is not selected. (Click away from it
on the empty stage if it is. If it's still selected, and you make the changes to the text field
properties in the following steps, it will overwrite the properties you just set with these new
properties.)
2. With the Text Tool still selected, select Input Text from the Text Tool drop-down menu in the
Properties panel.
3. Choose an appropriate font family, style, color, and size from the Character pane. (Because the
player will be entering no more than three numbers, and I want to try and fulfill one of my
GUI design tenets to “make it obvious,” I gave the input text a font size of 36 points so that it's
really obvious to the player where they'll need to type, and the numbers will be nice and big
when they do.)
4. You'll create the input text field so that it has a border around it. This will again help your goal
to “make it obvious” by clearly indicating to the player where they have to enter the number.
To add a border around a text field, you need to select the Show border around text button in
the Character pane of the Properties panel. It's a little hard to find, but Figure 5-7 shows you
where to look.
Figure 5-7. Select the Show border around text button.
 
Search Nedrilad ::




Custom Search