Game Development Reference
In-Depth Information
To create the class, simply create a new ActionScript file with the name Cen]bba*]o. (Flash automati-
cally and invisibly creates a file like this in the background if you don't create one yourself.)
Using properties and methods
Let's take a look at what this imaginary Cen]bba class might look like (you'll notice a few new things in
this class that you haven't yet seen before, including the keyword lner]pa; I'll discuss them shortly):
l]_g]ca
w
eilknpbh]od*`eolh]u*Ikrea?hel7
lq^he__h]ooCen]bbaatpaj`oIkrea?hel
w
++Lnklanpeao
lner]par]n[dqjcnu6>kkha]j7
lner]par]n[b]rknepa=_perepu6Opnejc7
lq^he_bqj_pekjCen]bba$%
w
[dqjcnu9pnqa7
[b]rknepa=_perepu9a]pejc7
y
++Iapdk`o
lner]pabqj_pekja]pHa]rao$%6rke`
w
++***`ena_perao
y
lner]pabqj_pekjs]j`an=eihaoohu$%6rke`
w
++***`ena_perao
y
y
y
A class is essentially a description of an object. I'm sure you can get a pretty good idea of what the life
of the poor giraffe is like by looking at the preceding class! A class describes an object in two ways:
Properties : The “things that it is”
Methods : The “things that it does”
Properties is just another name for variables such as these:
[dqjcnu
[b]rknepa=_perepu
Yes, they're just plain old variables—as simple as that! (I'll explain the underscore in front of
their names in a moment.) Properties also refer to all the built-in Movie Clip properties (such as t, u,
nkp]pekj, and reoe^ha) that you've been using all along.
 
Search Nedrilad ::




Custom Search