topical media & game development

talk show tell print

professional-flex-code-15-CustomTweenEffectInstance.ax

professional-flex-code-15-CustomTweenEffectInstance.ax [swf] flex


  package
  {
      import mx.effects.effectClasses.TweenEffectInstance;
      import mx.effects.Tween;
  
      public class @ax-professional-flex-code-15-CustomTweenEffectInstance extends TweenEffectInstance
      {
          // Custom parameters
          public var xFrom:Number;
          public var xTo:Number;
    
          public function @ax-professional-flex-code-15-CustomTweenEffectInstance(targetObj:Object)         {
            super(targetObj);
          }
    
          // Override play() method.
          override public function play():void         {
            super.play();
            // Create the Tween object
            var tween:Tween = createTween(this, xFrom, xTo, duration);     
          }
  
          // Override onTweenUpdate() method.
          override public function onTweenUpdate(val:Object):void         {
            target.x = val;
          }
    
          // Override onTweenEnd() method.
          override public function onTweenEnd(val:Object):void         {
            // call super.onTweenEnd().
            super.onTweenEnd(val);
          }
      }
  }
  
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.