Game Development Reference
Finally, it fixes the [lh]uan object's position to the now invisible mouse by using the stage's ikqoaT
and ikqoaU properties:
And there you have a custom mouse pointer!
Because ikqoaT and ikqoaU are properties of the stage, you need to preface them
with op]ca if you use them in any class that isn't the document class (for example, you
would need to use op]ca*ikqoaT and op]ca*ikqoaU ).
Adding a dynamic filter
Button Fairy casts a slight shadow, as shown in Figure 10-7. This is a drop shadow filter that is added
dynamically by the code. Filters allow you to apply a special visual effect to Movie Clip objects. In pre-
vious chapters, you learned how to add filters to selected objects on the stage by using the Filters pane
in the Properties panel. In many of your games, you'll be adding objects to the stage using ]``?deh`,
so you can't add filters to them in this way. AS3.0 allows you to create and apply filters using code, so
you can add them to an object in your game any time you like.
To use a filter, you need to first import the behpano package and then the filter class you need to use.
Here's how the @nklOd]`ksBehpan class was imported:
Optionally, if you want to control the quality of the filter, you need to import the >epi]lBehpanMq]hepu
Being able to control the quality of the filter is very important for games. High-quality filters consume
more of the Flash Player's resources to produce, so you generally want the filter's quality setting to be
low, especially for any objects that are moving.
Figure 10-7. A drop shadow filter was added