The Flex ShaderFilter class abstracts away many of the details of using
the Flash ShaderFilter, Shader, and ShaderData classes to apply a
Pixel Bender shader as a filter.
The ShaderFilter class must be initialized with either an instance of a Shader
object or Class representative of a Shader (such as from an Embed). The ShaderFilter
class then serves as a proxy to the underlying Shader, providing a convenience
mechanism for accessing both scalar and multi-dimensional shader input parameters
directly as simple named properties.
To set a simple scalar shader input parameter, such as of type FLOAT or INT, you can
refer to the property directly, for example, myFilter.radius.
To set or animate an individual component of a multidimensional shader input parameter, such as
FLOAT2, you can use a property suffix convention to access the individual value directly.
The following code shows two ways to set the first and second components of the FLOAT2
// 'center' is an input parameter of type FLOAT2.
shader.center = [10,20];
// Use property suffix convention to access the first and second component of 'center'.
shader.center_x = 10;
shader.center_y = 20;
The full set of supported property suffixes that you can use are as follows:
For shader input parameters of type BOOL2, BOOL3, BOOL4, FLOAT2, FLOAT3, FLOAT4, INT2,
INT3, or INT4, you can use "r g b a", "x y z w", or "s t p q"
to access the 1st, 2nd, 3rd and 4th component, respectively.
For shader input parameters of type MATRIX2x2, MATRIX3x3, or MATRIX4x4, you can use
"a b c d e f g h i j k l m n o p" to access the
1st - 16th component of a given matrix, respectively.
As properties on the ShaderFilter change (such as during animation), the
ShaderFilter automatically reapplies itself to the filters array of the visual
component it is applied to.