Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 229

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

Advertisement

<!-- 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.
The instance class implements the effect logic. When an effect trigger
Instance class
occurs, or when you call the
object of the 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 of an instance class is the name of the effect with the suffix Instance,
such as ZoomInstance or FadeInstance.
About the effect base classes
You define effects by creating a subclass from the effects class hierarchy. Typically, you create a
subclass from one of the following classes:
mx.effects.Effect
an effect to play over a period of time. For example, the Pause effect inserts a delay
between two consecutive effects. You can also define a simple sound effect that plays an
MP3 file.
mx.effects.TweenEffect
over a period of time, such as an animation. For example, the Resize effect is a subclass of
the TweenEffect class that modifies the size of its target over a specified duration.
About implementing your effects classes
You must override several methods and properties in your custom effect classes, and define
any new properties and methods that are required to implement the effect. You can optionally
override additional properties and methods based on the type of effect that you create.
method to invoke an effect, the factory class creates an
play()
Create a subclass from this class for simple effects that do not require
Create a subclass from this class to define an effect that plays
About creating a custom effect
229

Advertisement

Table of Contents
loading

Table of Contents