Game Development Reference
In-Depth Information
r]nop]npL]ca6Op]npL]ca7
The var keyword tells
the program that
you're creating a
variable.
This is the variable name, which
can be anything you choose. You
can now access the variable using
this name in the program.
This is the type of variable you're creating.
In this project, the variable will store a
reference to the StartPage symbol in the
Library, so it has the same name. The
variable will be a “type of StartPage.”
Figure 3-2. The variable declaration
Whoa, that's suddenly a lot to absorb very quickly! And what are variables, anyway? Let's take a break
for a moment and find out what they are and how to use them.
Variables
You can think of variables as little boxes that store information. Every box has its own name and
stores different kinds of information.
Figure 3-3 illustrates three imaginary variables called o_kna, j]ia, and ajaiu. Each variable name is
associated with a box that contains information.
Figure 3-3. Variables are like boxes that store information.
If you need to use the information inside the box, you just need to refer to the box's name anywhere
in the program. For example, if you want to find out what the current score is, use the variable name
o_kna; the program will interpret it as /4. If you want to reference the dragon Movie Clip, use the
word ajaiu.
You can also empty the box at any time and put new information into it. It's variable!
That's all variables are: storage containers with names.
 
Search Nedrilad ::




Custom Search