356
ActionScript classes
To clear the filters for a button, set
filters
to an empty array (
[]
).
At load time, if a button has an associated filter, it is marked to cache itself as a transparent
bitmap. From this point forward, as long as the button has a valid filter list, the player caches
the button as a bitmap. This bitmap is used as a source image for the filter effects. Each
button usually has two sets of bitmaps: one with the original unfiltered source button and
another for the final images (in each of the four button states) after filtering. The final image
set is used when rendering. As long as the button does not change, the final image does not
need updating.
If you are working with a
filters
array that contains multiple filters and you need to track
the type of filter assigned to each array index, you can maintain your own
filters
array and
use a separate data structure to track the type of filter associated with each array index. There
is no simple way to determine the type of filter associated with each
filters
array index.
Availability:
ActionScript 1.0; Flash Player 8
Example
The following example adds a drop shadow filter to a button named
myButton
.
import flash.filters.DropShadowFilter;
var myDropFilter:DropShadowFilter = new DropShadowFilter(6, 45, 0x000000,
50, 5, 5, 1, 2, false, false, false);
var myFilters:Array = myButton.filters;
myFilters.push(myDropFilter);
myButton.filters = myFilters;
The following example changes the
quality
setting of the first filter in the array to 15 (this
example works only if at least one filter object has been associated with the
myButton
text
field).
var myList:Array = myButton.filters;
myList[0].quality = 15;
myButton.filters = myList;
See also
,
cacheAsBitmap (Button.cacheAsBitmap property)
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...