Game Development Reference
In-Depth Information
w
dehhL]ca*_]p*u9..,7
y
pn]_a$dehhL]ca*_]p*u%7
y
bqj_pekjkjCnks>qppkj?he_g$arajp6IkqoaArajp%6rke`
w
dehhL]ca*_]p*se`pd'9-17
dehhL]ca*_]p*daecdp'9-17
y
bqj_pekjkjOdnejg>qppkj?he_g$arajp6IkqoaArajp%6rke`
w
dehhL]ca*_]p*se`pd)9-17
dehhL]ca*_]p*daecdp)9-17
y
bqj_pekjkjReoe^ehepu>qppkj?he_g$arajp6IkqoaArajp%6rke`
w
dehhL]ca*_]p*reoe^ha9b]hoa7
y
y
y
5. Save the I]ej*]o file and test the project.
6. Click the visibility button. The cat will vanish!
The directive that accomplished this disappearing act was this line in the kjReoe^ehepu>qppkj?he_g
event handler:
dehhL]ca*_]p*reoe^ha9b]hoa7
Like the other properties you've seen, the reoe^ha property is simply attached to the object using
dot notation. Unlike them, however, this is the first property you've seen that uses the b]hoa Boolean
value. This directive basically means, “No, the cat is not visible.” If you want to make the cat reappear
later, you can assign the pnqa value.
After you clicked the visibility button in the storybook, the little cat was not only gone, but gone for
good. No amount of clicking the button could bring it back. The cat is still actually on the stage as an
object you can program; you just can't see it. How can you make the cat visible again?
There are two ways. One way is to create another button and program it with exactly the same code
as the visibility button, except that you give the reoe^ha property a value of pnqa. The second way is
a bit more fun: use a single button to make the cat both disappear and reappear.
If the two states that you're toggling between can be defined with pnqa and b]hoa values, AS3.0 allows
a very easy way to make a toggle button using the not operator , which is simply an exclamation mark,
like this:
 
Search Nedrilad ::




Custom Search