topical media & game development

talk show tell print

lib-flex-ximpel-editor-net-ximpel-classes-VisualTransformation.ax

lib-flex-ximpel-editor-net-ximpel-classes-VisualTransformation.ax (swf ) [ flash ] flex


  /*
      This program is free software: you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published by
      the Free Software Foundation, either version 3 of the License.
  
      This program is distributed in the hope that it will be useful,
      but WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      GNU General Public License for more details.
  
      You should have received a copy of the GNU General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
          Javier Quevedo Fernández 05-2009.
  
  */
  package net.ximpel.classes
  {
          import flash.geom.ColorTransform;
          
          import mx.effects.Fade;
          import mx.effects.Glow;
          
          public class @ax-lib-flex-ximpel-editor-net-ximpel-classes-VisualTransformation
          {
                  public var dissolveEffectIn : Glow;
                  public var dissolveEffectOut : Glow;
                  private var greenGlow : Glow;
                  private var blueGlow : Glow;
                  private var glow : Glow;
                  public var target : Object;
                  private var fadeIn : Fade;
                  public var fadeOut : Fade;
                  private var fade : Fade;
                  public var fadeDuration : int = 1000;
                  
                  public function @ax-lib-flex-ximpel-editor-net-ximpel-classes-VisualTransformation(targe : Object)
                  {
                          target = targe;        
                          dissolveEffectIn = new Glow();
                          dissolveEffectIn.duration=500;
                          dissolveEffectIn.alphaFrom=1.0;
                          dissolveEffectIn.alphaTo=0.0;
                          dissolveEffectIn.blurXFrom=0.0;
                          dissolveEffectIn.blurXTo=30.0;
                          dissolveEffectIn.blurYFrom=0.0; 
                          dissolveEffectIn.blurYTo=50.0; 
                          dissolveEffectIn.color=0xFF0000;
                          dissolveEffectIn.target = target;        
                          
                           
                          dissolveEffectOut = new Glow();
                          dissolveEffectOut.duration=500; 
                  dissolveEffectOut.alphaFrom=0.0; 
                  dissolveEffectOut.alphaTo=1.0; 
                  dissolveEffectOut.blurXFrom=30.0; 
                  dissolveEffectOut.blurXTo=0.0; 
                  dissolveEffectOut.blurYFrom=50.0; 
                  dissolveEffectOut.blurYTo=0.0; 
                  dissolveEffectOut.color=0xFF0000;  
                  dissolveEffectOut.target=target;   
          
                          
                  }
                  
                  public function greenGlowPlay(target : Object):void
                  {
                          glowPlay(target,0x00FF00);
                  }
                  public function blueGlowPlay(target: Object):void
                  {
                          glowPlay(target,0x0000FF);
                  }
                  
                  public function yellowGlowPlay(target:Object):void
                  {
                          glowPlay(target, 0xBBBB33);
                  }
                  
                  private function glowPlay(target : Object, color : int):void
                  {
                          
                          if (!glow)
                          {
                                  glow = new Glow();
                                  glow.duration=1500; 
                          glow.alphaFrom=0.0; 
                          glow.alphaTo=0.85; 
                          glow.blurXFrom=30.0; 
                          glow.blurXTo=100.0; 
                          glow.blurYFrom=30.0; 
                          glow.blurYTo=100.0; 
                          glow.color=color;  
                  }
                             glow.target=target;                         
                  glow.play();
                  }
                  
                  public function fadeSome(target:Object, opacity : Number):void
                  {
                  if (!fade)
                          {
                                  fade = new Fade();
                          fade.alphaFrom=1.0;
                          fade.duration=fadeDuration;        
                             }
                             fade.alphaTo=opacity;        
                             fade.target=target;
                  fade.play();        
                  }
                  
                  
                  public function fadeInPlay(target : Object):void
                  {
                          if (!fadeIn)
                          {
                                  fadeIn = new Fade();
                          fadeIn.alphaFrom=0.0;
                          fadeIn.alphaTo=1.0;
                          fadeIn.duration=fadeDuration;        
                             }
                             fadeIn.target=target;
                  fadeIn.play();
                  }
                  
                  public function fadeOutPlay(target : Object):void
                  {
                          if (!fadeOut)
                          {
                                  fadeOut = new Fade();
                          fadeOut.alphaFrom=1.0;
                          fadeOut.alphaTo=0.0;
                          fadeOut.duration=fadeDuration;        
                             }
                             fadeOut.target=target;
                  fadeOut.play();
                  }
                  
                  public  function disabledColorTransform (target : Object) : void {
                      target.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 5,5, 200, 0);
                      
                  }
                  
                  
                  
  
          }
  }


(C) Æliens 19/08/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.