MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference page 1178

Actionscript 2.0 language reference
Table of Contents

Advertisement

Filters can be applied in the Flash authoring tool at design-time, or at runtime using
ActionScript code. To apply a filter using ActionScript, you must make a temporary copy of
the entire
TextField.filters
of the temporary array back to the
filter object to the
TextField.filters
text field, named
myTextField
myTextField.filters[0].push(myDropShadow);
To add a filter using ActionScript, you must follow these steps (assume that the target movie
clip is named
myTextField
Create a new filter object using the constructor function of your chosen filter class.
Assign the value of the
named
myFilters
Add the new filter object to the temporary array,
Assign the value of the temporary array to the
If the
array is empty, you need not use a temporary array. Instead, you can directly
filters
assign an array literal that contains one or more filter objects that you have created.
To modify an existing filter object, whether it was created at design-time or at runtime, you
must use the technique of modifying a copy of the
Assign the value of the
named
myFilters
Modify the property using the temporary array,
set the
property of the first filter in the array, you could use the following code:
quality
myList[0].quality = 1;
Assign the value of the temporary array to the
To clear the filters for a text field, set
If you are working with a
the type of filter assigned to each array index, you can maintain your own
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
Availability: ActionScript 1.0; Flash Player 8
Example
The following example adds a drop shadow filter to a text field named
var myDropFilter = new flash.filters.DropShadowFilter();
var myFilters:Array = myTextField.filters;
myFilters.push(myDropFilter);
1178
ActionScript classes
array, modify the temporary array, and then assign the value
TextField.filters
array. The following code has no effect on the target
:
):
myTextField.filters
.
myTextField.filters
.
filters
array that contains multiple filters and you need to track
filters
array. You cannot directly add a new
array to a temporary array, such as one
.
myFilters
myTextField.filters
array, as follows:
filters
array to a temporary array, such as one
. For example, if you want to
myFilters
myTextField.filters
to an empty array (
[]
array.
array.
).
array and
filters
array index.
filters
.
myTextField

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash 8

Table of Contents