User Guide
228 Creating Effects
About creating a custom effect
Flex implements effects by using an architecture in which each effect is represented by two
classes: a factory class and an instance class. Therefore, to implement a custom effect, you
create two classes: the factory class and the instance class.
You create a factory class by creating a subclass of the mx.effects.Effect class, or by creating a
subclass of one of the subclasses of the mx.effects.Effect class. You create an instance class by
creating a subclass of the mx.effects.EffectInstance class, or a subclass of one of the subclasses
of the mx.effects.EffectInstance class.
The following image shows the class hierarchy for effects:
Defining factory and instance classes
To define a custom effect, you create two classes: the factory class and the instance class:
Factory class The factory class creates an object of the instance class to perform the effect
on the target. You create a factory class instance in your application, and configure it with the
necessary properties to control the effect, such as the zoom size or effect duration. You then
assign the factory class instance to an effect trigger of the target component, as the following
example shows:
Effect
MaskEffect TweenEffect
CompositeEffect
effect classeseffect classes
effect classes
EffectInstance
MaskEffectInstance TweenEffectInstance CompositeEffectInstance
effect instance classeseffect instance classes
effect instance classes
Factory classes
Instance classes