Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 243

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

Advertisement

Flex applies the destination view state to the application.
5.
Flex dispatches the
6.
Flex plays the effects defined in the transition.
7.
As part of playing the effect, Flex invokes the factory class
, to initialize
Effect.play()
Example: Creating a transition effect
This section modifies the Rotation effect created in
on page 238
to make the effect usable in a transition.
The following example shows the RotationTrans.as class that definesthe factory class for the
effect. The only modification you make to Rotation.as to create RotationTrans.as is to remove
the default value definitions for the
RotationTransInstance.play()
package myEffects
{
// myEffects/RotationTrans.as
import mx.effects.TweenEffect;
import mx.effects.EffectInstance;
import mx.effects.IEffectInstance;
public class RotationTrans extends TweenEffect
{
// Define parameters for the effect.
// Do not specify any default values.
// The default value of these properties is NaN.
public var angleFrom:Number;
public var angleTo:Number;
// Define constructor with optional argument.
public function RotationTrans(targetObj:Object = null) {
super(targetObj);
instanceClass= RotationTransInstance;
}
// Override getAffectedProperties() method to return "rotation".
override public function getAffectedProperties():Array {
return ["rotation"];
}
// Override initInstance() method.
override protected function initInstance(inst:IEffectInstance):void
{
super.initInstance(inst);
RotationTransInstance(inst).angleFrom = angleFrom;
currentStateChange
propertyChanges.end
angleFrom
method determines the default values.
event.
play()
for effect instances.
"Example: Creating a tween effect"
and
property definitions. The
angleTo
Writing an effect for a transition
method,
243

Advertisement

Table of Contents
loading

Table of Contents