LetsFlex

Effects

by jlagunas on Dec.17, 2008, under Actionscript

Using the Fade effect class via Actionscript. The same thing can be done with the other effects such as Move.

import mx.effects.Fade;
import mx.effects.Move;
import mx.effects.easing.Cubic;

public function FadeEffect(target:Object, duration:Number, delay:Number, alphaFrom:Number, alphaTo:Number):void
{
	var fadeEffect:Fade = new Fade();
	fadeEffect.end();
	fadeEffect.target = target;
	fadeEffect.duration = duration;
	fadeEffect.startDelay = delay;
	fadeEffect.easingFunction = Cubic.easeInOut;
	fadeEffect.alphaFrom = alphaFrom;
	fadeEffect.alphaTo = alphaTo;
	fadeEffect.play();
}

public function MoveEffect(target:Object, duration:Number, delay:Number, xStart:Number, xEnd:Number, yStart:Number, yEnd:Number):void
{
	var moveEffect:Move = new Move();
	moveEffect.end();
	moveEffect.target = target;
	moveEffect.duration = duration;
	moveEffect.startDelay = delay;
	moveEffect.easingFunction = Cubic.easeInOut;
	moveEffect.xFrom = xStart;
	moveEffect.xTo = xEnd;
	moveEffect.yFrom = yStart;
	moveEffect.yTo = yEnd;
	moveEffect.play();
}
	
:
1 comment for this entry:
  1. LetsFlex › Actionscript based effects examples

    [...] jlagunas on Dec.18, 2008, under Actionscript Here’s an example of the effects code from a previous post. It moves the flex icon from the top left to the bottom right and then [...]

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...