# How do I do aColor transition and an alpha fade using Tween class?

**URL:** <https://forum.kirupa.com/t/how-do-i-do-acolor-transition-and-an-alpha-fade-using-tween-class/186762>\
**Category:** flash\
**Created:** [April 24, 2006, 1:23pm UTC](https://forum.kirupa.com/t/how-do-i-do-acolor-transition-and-an-alpha-fade-using-tween-class/186762 "2006-04-24T13:23:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daffy\_dowden](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daffy_dowden/32/2371_2.png) [@daffy\_dowden](https://forum.kirupa.com/u/daffy_dowden)\
**Post date:** [April 24, 2006, 1:23pm UTC](https://forum.kirupa.com/t/how-do-i-do-acolor-transition-and-an-alpha-fade-using-tween-class/186762/1 "2006-04-24T13:23:55Z")

</div>

Hi All,

Got a few questions relating to the tween class.  
Basically I have 3 circles using 1 instance of my circle mc. Within this there is a background mc which is the circle.  
What I want to do, is make it so that when the user hovers over a circle that circle changes colour and fades and when they rollout it goes back to norm.

I’ve taken code from by TheCanadian from [this post](http://www.kirupa.com/forum/showthread.php?t=210435) and adapted it for my task, but I can’t get it fully working.

```auto

import mx.transitions.Tween;
import mx.transitions.easing.*;
 
function colorFade(object_mc:Color):Void {
 var trans:Object = object_mc.getTransform();
 //fade to orange
 var rb:Tween = new Tween(trans, "rb", Strong.easeOut, trans.rb, 0xFF, 3, true);
 var gb:Tween = new Tween(trans, "gb", Strong.easeOut, trans.gb, 0x99, 3, true);
 var bb:Tween = new Tween(trans, "bb", Strong.easeOut, trans.bb, 0x33, 3, true);
  
 trace("offsets "+trans.ra + " " + traces.ga + " " + trans.ba);
 
 rb.onMotionChanged = function():Void {
  object_mc.setTransform(trans);
 };
};
 
// Aspiration Cirlc
aspiration_mc.onRollOver = function():Void {
 var colorVar:Color = new Color(aspiration_mc.circleColor_mc);
 colorVar.setRGB(0x003399);
 colorFade(colorVar);
};

```

So my first question is, am I going the right way, trying to use the function like that. And second, is it possible to control the fade within the one statement? or will I need to do that separately?

Many Thanks,  
Rich :evil2:

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 24, 2006, 1:31pm UTC](https://forum.kirupa.com/t/how-do-i-do-acolor-transition-and-an-alpha-fade-using-tween-class/186762/2 "2006-04-24T13:31:22Z")

</div>

> is it possible to control the fade within the one statement? or will I need to do that separately?

```auto
var alpha:Tween = new Tween(trans, "_alpha", Strong.easeOut, 100, 0, 3, true);

```
