Game Development Reference
In-Depth Information
In this topic I use the phrase “test the project” to mean publishing a SWF while work-
ing on it. There are three ways to do this:
Click the Test Project button in the Project panel.
Select Control ° Test Movie .
Use this useful Flash shortcut: in OSX, hold down the Apple key and press Enter . In
Windows, hold down the Ctrl key and press Enter .
All these techniques generate a SWF file in the project folder on your computer's hard
drive and then run it immediately for you to see the result.
How did that work?
The format that you've used for the program so far is exactly the same as the format you used for the
Hello World program in Chapter 1. Refer to that chapter if there's anything about the basic structure
of this code that you think you don't quite understand. There are three new lines of code that you
haven't seen before, and I'll go into detail about how they work. I've highlighted the new code for
you here:
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel7
lq^he__h]ooI]ejatpaj`oIkrea?hel
w
r]nop]npL]ca6Op]npL]ca7
lq^he_bqj_pekjI]ej$%
w
op]npL]ca9jasOp]npL]ca7
]``?deh`$op]npL]ca%7
y
y
y
The first thing the code did was to create a new variable called op]npL]ca. That's what this line does
(the variable's name is highlighted):
r]n op]npL]ca 6Op]npL]ca7
In programming terms, this directive is known as a variable declaration. It creates a variable called
op]npL]ca that you can use in the program and control with code.
Figure 3-2 illustrates the structure of this variable declaration in detail. (Pay very close attention to
the two terms in the new code: op]npL]ca and Op]npL]ca. They're actually two completely different
objects, and the differences in their capitalization help to tell them apart. I'll explain how in a bit.)
 
Search Nedrilad ::




Custom Search