User Guide
Button 355
//button code
// the following function will not get called
// because myBtn2_btn.enabled was set to false
myBtn1_btn.onRelease = function() {
trace( "you clicked : " + this._name );
};
myBtn2_btn.onRelease = function() {
trace( "you clicked : " + this._name );
};
filters (Button.filters property)
public filters : Array
An indexed array containing each filter object currently associated with the button. 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
Button.filters array, modify the temporary array, and then assign the value of
the temporary array back to the
Button.filters array. You cannot directly add a new filter
object to the
Button.filters array. The following code has no effect on the target button,
named
myButton:
myButton.filters[0].push(myDropShadow);
To add a filter using ActionScript, you must follow these steps (assume that the target button
is named
myButton):
■ Create a new filter object using the constructor function of your chosen filter class.
■ Assign the value of the myButton.filters array to a temporary array, such as one named
myFilters.
■ Add the new filter object to the temporary array, myFilters.
■ Assign the value of the temporary array to the myButton.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:
■ Assign the value of the myButton.filters array to a temporary array, such as one named
myFilters.
■ Modify the property using the temporary array, 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;
■ Assign the value of the temporary array to the myButton.filters array.