Game Development Reference
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
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,