Game Development Reference
In-Depth Information
Filters are independent objects, just like any other objects you create in AS3.0. To use a filter, you first
need to create the filter object, set its properties, and then add it to the object that you want to apply
the filter to. Here are the steps to create and apply the drop shadow filter:
1. To use a filter, you need to declare a variable to contain the new filter object:
2. Create the filter object with the jas operator:
3. Set any of the filter's properties. Most of the properties for most filters match those that you
can set in the Filters pane of the Properties panel. You can set as many or as few of these prop-
erties as you need to:
4. Set the optional quality property of the filter by applying HKS, IA@EQI, or DECD from the
>epi]lBehpanMq]hepu class:
5. Every Movie Clip object has a special property called behpano. Unlike any other property you've
looked at before, the behpano property is actually an array. You apply a filter to an object by
adding the filter as an element to the behpano array (which is the same way elements were
added to an array in Chapter 9). In this example, I want the shadow to be applied only to the
[lh]uan object's ^k`u subobject:
Adding filters as array elements is very useful because it means that you can apply more than one
filter to an object at a time. If you want to also add a bevel or glow filter to the same object, you can
create those filter objects and add them to the behpano array, like this:
To remove all the filters from an object, give the filters array a jqhh value, like this:
Table 10-1 lists the basic filter classes and their uses.
Search Nedrilad ::

Custom Search