User Guide

244 Creating Effects
RotationTransInstance(inst).angleTo = angleTo;
}
}
}
In the RotationTransInstance.as class, you modify the play() method to calculate the default
values for the
angleFrom and angleTo properties. This method performs the following
actions:
1. Determines whether the user set values for the angleFrom and angleTo properties.
2. If not, determines whether the Effectinstance.propertyChanges property was
initialized with start and end values. If so, the method uses those values to configure the
effect.
3. If not, sets the angleFrom and angleTo properties to the default values of 0 for the
angleFrom property, and 360 for the angleTo property.
The following example shows the RotationTransInstance.as class:
package myEffects
{
// myEffects/RotationTransInstance.as
import mx.effects.effectClasses.TweenEffectInstance;
import mx.effects.Tween;
public class RotationTransInstance extends TweenEffectInstance
{
// Define parameters for the effect.
public var angleFrom:Number;
public var angleTo:Number;
public function RotationTransInstance(targetObj:Object) {
super(targetObj);
}
// Override play() method class.
override public function play():void {
// All classes must call super.play().
super.play();
// Check whether angleFrom is set.
if (isNaN(angleFrom))
{
// If not, look in propertyChanges.start for a value.
// Otherwise, set it to 0.
angleFrom = (propertyChanges.start["rotation"] != undefined) ?
propertyChanges.start["rotation"] : 0;
}