Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 239

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

Advertisement

In this example, the effect works by modifying the
component. Therefore, your override of the
array that containsa single element.
You derive your instance class from the TweenEffectInstance class, and override the
, and
onTweenUpdate()
package myEffects
{
// myEffects/RotationInstance.as
import mx.effects.effectClasses.TweenEffectInstance;
import mx.effects.Tween;
public class RotationInstance extends TweenEffectInstance
{
// Define parameters for the effect.
public var angleFrom:Number;
public var angleTo:Number;
public function RotationInstance(targetObj:*) {
super(targetObj);
}
// Override play() method class.
override public function play():void {
// All classes must call super.play().
super.play();
// Create a Tween object. The tween begins playing immediately.
var tween:Tween =
createTween(this, angleFrom, angleTo, duration);
}
// Override onTweenUpdate() method.
override public function onTweenUpdate(val:Object):void {
target.rotation = val;
}
// Override onTweenEnd() method.
override public function onTweenEnd(val:Object):void {
// All classes that implement onTweenEnd()
// must call
super.onTweenEnd(val);
}
}
}
getAffectedProperties()
methods, as the following example shows:
onTweenEnd()
super.onTweenEnd().
property of the target
rotation
About tween effects
method returns an
,
play()
239

Advertisement

Table of Contents
loading

Table of Contents