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:
lner]par]n[od]`ks6@nklOd]`ksBehpan7
2. Create the filter object with the jas operator:
[od]`ks9jas@nklOd]`ksBehpan$%7
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:
[od]`ks*`eop]j_a907
[od]`ks*]jcha9-.,7
[od]`ks*opnajcpd9,*27
4. Set the optional quality property of the filter by applying HKS, IA@EQI, or DECD from the
>epi]lBehpanMq]hepu class:
[od]`ks*mq]hepu9>epi]lBehpanMq]hepu*HKS7
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:
[lh]uan*^k`u*behpano9W[od]`ksY7
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:
[lh]uan*^k`u*behpano9W[od]`ks([^arah([chksY7
To remove all the filters from an object, give the filters array a jqhh value, like this:
[lh]uan*^k`u*behpano9jqhh
Table 10-1 lists the basic filter classes and their uses.
 
Search Nedrilad ::




Custom Search