Creating Custom Effects
Although you can use standard effects and composite effects to solve most of an application’s effects requirements, sometimes these off-the-shelf solutions won’t achieve the intended result. For those cases, the Flex framework allows you to create your own custom effects that you can use exactly as you would use other standard effects.
Creating custom effects requires a more thorough understanding of the effect framework structure. Because working with effects is so simple, it’s not necessary to look at the inner workings of the effect framework until you want to write a custom effect.
The effect framework consists of two basic types of classes:
effect factories and effect instances. When you create a new effect object using MXML or
ActionScript, you are working with an effect factory class. However, when
the effect is applied to a component, the actual object utilized is an
effect instance (one that is created automatically behind the scenes). The
effect objects that you create using MXML and/or ActionScript using
classes such as Move
or Resize
utilize a design pattern called the
Factory Method. The
Factory Method pattern means that the factory class is responsible for creating the
effect instances, which are what are applied to the components.
Next we’ll look at how to define factory and instance classes.
Defining an Effect Instance Class
The effect instance class is the one used as the blueprint for the actual objects that apply the effect to the components. ...
Get Programming Flex 3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.