About Creating A Custom Effect - Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

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:
Effect
MaskEffect
TweenEffect
CompositeEffect
effect classes
effect classes
effect classes
Factory classes
EffectInstance
MaskEffectInstance
TweenEffectInstance
CompositeEffectInstance
effect instance classes
effect instance classes
effect instance classes
Instance classes
Defining factory and instance classes
To define a custom effect, you create two classes: the factory class and the instance class:
The factory class creates an object of the instance class to perform the effect
Factory class
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:
228
Creating Effects

Advertisement

Table of Contents
loading

Table of Contents