Adobe FLEX 2-MIGRATING APPLICATIONS TO FLEX 2 Manual page 130

Migrating applications to flex 2
Table of Contents

Advertisement

Overview
Flex implements effects using an architecture in which each effect is represented by two
classes:
Creates an object of the instance class to perform the effect on the target.
Factory class
You create instances of the factory class 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 a target component, as the following example
shows:
<!-- Define factory class. -->
<mx:WipeDown id="myWD" duration="1000"/>
<!-- Assign factory class to effect targets.-->
<mx:Button id="myButton" mouseDownEffect="{myWD}"/>
<mx:Button id="myOtherButton" mouseDownEffect="{myWD}"/>
By convention, the name of a factory class is the name of the effect, such as Zoom or Fade.
Instance class
call the
method to invoke an effect, the factory class creates an object of the
play()
instance class to perform the effect on the target. When the effect ends, Flex destroys the
instance object. If the effect has multiple target components, the factory class creates
multiple instance objects, one per target.
By convention, the name an instance class is the name of the effect with the suffix
Instance, such as ZoomInstance or FadeInstance.
When you use effects in your application, you are only concerned with the factory class; the
instance class is an implementation detail. However, if you want to create custom effects
classes, you must implement a factory class and an instance class. For more information, see
Chapter 15, "Creating Effects," in the Creating and Extending Flex Components book.
130
Behaviors
Implements the effect logic. When an effect trigger occurs, or when you

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex 2

Table of Contents