Game Development Reference
2. Save the I]ej*]o file and test the program. You should see the words I am thinking of a number
between 1 and 100 appear in the output text field, and the input text field should be blank, as
shown in Figure 5-11.
Figure 5-11. The text of the startMessage variable is
displayed in the output text field.
The first thing you did was to declare two variables in the I]ej class. You used variables in earlier
chapters, but there's something new here—the variable types (which follow the colon):
What are these variable types?
You might recall from the previous chapter that when you created variables to hold references to
the Movie Clip objects, you declared their type to be the symbol in the Library from which they were
made. A line of code such as r]nlkj`L]ca6Lkj`L]ca7 meant that the lkj`L]ca instance was a type
of the Lkj`L]ca symbol in the Library .
The previous code does something very similar. The line r]nop]npIaoo]ca6Opnejc7 means that the
op]npIaoo]ca variable is a type of Opnejc. The line r]niuopanuJqi^an6qejp7 means that the variable
iuopanuJqi^an is a type of qejp (which stands for unsigned integer ).
Okay, that's pretty meaningless, isn't it? Don't worry; it will become clear soon!
Let's a take a step back. When you declare a variable, you need to tell the program what type of
information that variable will be holding. Will you be using the variable to store numbers or words?
If you're using it to store numbers, what kind of numbers will they be? Hey, it might seem like more
detail than you need, but AS3.0 wants this information to make sure that you don't start trying to mix
variables that contain words with variables that contain numbers or any of the other kinds of possibly
incompatible data types that variables can contain.