Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > TextField > filters (TextField.filters property) | |||
public filters : Array
An indexed array containing each filter object currently associated with the text field. The flash.filters package contains several classes that define specific filters that you can use.
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 array, modify the temporary array, and then assign the value of the temporary array back to the TextField.filters array. You cannot directly add a new filter object to the TextField.filters array. The following code has no effect on the target 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):
myTextField.filters array to a temporary array, such as one named myFilters.myFilters.myTextField.filters array.If the filters array is empty, you need not use a temporary array. Instead, you can directly 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 filters array, as follows:
myTextField.filters array to a temporary array, such as one named myFilters.myFilters. For example, if you want to set the quality property of the first filter in the array, you could use the following code: myList[0].quality = 1;myTextField.filters array.To clear the filters for a text field, set filters to an empty array ([]).
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
The following example adds a drop shadow filter to a text field named myTextField.
var myDropFilter = new flash.filters.DropShadowFilter(); var myFilters:Array = myTextField.filters; myFilters.push(myDropFilter); myTextField.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 myTextField text field).
var myList:Array = myTextField.filters; myList[0].quality = 15; myTextField.filters = myList;
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00002202.html