Jump to content


simple animation with changing the color


  • You cannot reply to this topic
2 replies to this topic

#1 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 20 January 2006 - 09:21 AM

Is it possible to make an animation only with AS, where would be one box for example and it will change its color from one to another.
Thank you in advance.

#2 funkysoul

    The Funky Stuff

  • Publishing Betazoids
  • PipPipPipPip
  • 2,307 posts
  • Gender:Male
  • Location:Zurich, Switzerland
  • Interests:Music: HIM, HIM, HIM, Cafe del Mar, Linkin Park, Fort Minor, Coldplay, Eric Jordan<br />Sports: Snowboarding, KiteSurfing, Extreme Sports<br />Computer: Flash, After Effects, Actionscript

Posted 20 January 2006 - 09:58 AM

If using Flash MX2004 or lower you need to use this:
var my_color:Color = new Color(my_mc);
my_color.setRGB(0xff9933);

Since Flash 8, this command has been replaced in favour of the Flash.geom.ColorTransform class

import flash.geom.ColorTransform;

var colorTrans_1:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
trace(colorTrans_1); 
//(redMultiplier=1, greenMultiplier=1, blueMultiplier=1, alphaMultiplier=1, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0)

var colorTrans_2:ColorTransform = new ColorTransform();
trace(colorTrans_2); 
//(redMultiplier=1, greenMultiplier=1, blueMultiplier=1, alphaMultiplier=1, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0)


#3 ribo6

    Young Padawan

  • Members
  • Pip
  • 18 posts

Posted 20 January 2006 - 01:10 PM

View Postfunkysoul, on Jan 20 2006, 09:58 AM, said:

If using Flash MX2004 or lower you need to use this:
var my_color:Color = new Color(my_mc);
my_color.setRGB(0xff9933);

Since Flash 8, this command has been replaced in favour of the Flash.geom.ColorTransform class

import flash.geom.ColorTransform;

var colorTrans_1:ColorTransform = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
trace(colorTrans_1); 
//(redMultiplier=1, greenMultiplier=1, blueMultiplier=1, alphaMultiplier=1, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0)

var colorTrans_2:ColorTransform = new ColorTransform();
trace(colorTrans_2); 
//(redMultiplier=1, greenMultiplier=1, blueMultiplier=1, alphaMultiplier=1, redOffset=0, greenOffset=0, blueOffset=0, alphaOffset=0)

Maybe you can help me again ;)
I've tried to get it to work, but with Tween it doesn't do anything.
On a stage there is only a box with instance name rect.
AS in the first frame:
import flash.geom.Transform;
import flash.geom.ColorTransform;
import mx.transitions.Tween;
import mx.transitions.easing.*;

var trans:Transform = new Transform(_root.rect);
var blueColorTransform:ColorTransform = new ColorTransform(0, 0, 0, 0, 166, 44, 44, 100);
trans.colorTransform = blueColorTransform;
var myTween1:Tween = new Tween(blueColorTransform, "greenOffset", Strong.easeOut, 44, 244, 1, true);





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users