# Color Tweens with AS

**URL:** <https://forum.kirupa.com/t/color-tweens-with-as/188748>\
**Category:** flash\
**Created:** [May 10, 2006, 1:44pm UTC](https://forum.kirupa.com/t/color-tweens-with-as/188748 "2006-05-10T13:44:40Z")\
**Posts on this page:** 1\
**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:** [May 10, 2006, 1:44pm UTC](https://forum.kirupa.com/t/color-tweens-with-as/188748/1 "2006-05-10T13:44:40Z")

</div>

Can anyone explain to me what I’m doing wrong here:

```auto

function colorFadeTo(object_mc:Color):Void {
    var trans:Object = object_mc.getTransform();
    //fade to orange
    var rb:Tween = new Tween(trans, "rb", Strong.easeOut, trans.rb, 255, 3, true);
    var gb:Tween = new Tween(trans, "gb", Strong.easeOut, trans.gb, 153, 3, true);
    var bb:Tween = new Tween(trans, "bb", Strong.easeOut, trans.bb, 0, 3, true);
    //trace("offsets "+trans.rb+" "+trans.gb+" "+trans.bb);
    rb.onMotionChanged = function():Void {
        object_mc.setTransform(trans);
    };
}
function colorFadeAway(object_mc:Color):Void {
    var trans:Object = object_mc.getTransform();
    //fade to orange
    var rb:Tween = new Tween(trans, "rb", Strong.easeOut, 0, trans.ra, 3, true);
    var gb:Tween = new Tween(trans, "gb", Strong.easeOut, 51, trans.ga, 3, true);
    var bb:Tween = new Tween(trans, "bb", Strong.easeOut, 153, trans.ba, 3, true);
    trace("offsets "+trans.ra+" "+trans.ga+" "+trans.ba);
    //trace("fade Away");
    rb.onMotionChanged = function():Void {
        object_mc.setTransform(trans);
    };
}
var colorVarAsp:Color = new Color(aspiration_mc.background_mc);
// Aspiration Cirlc
aspiration_mc.onRollOver = function():Void {
    colorVarAsp.setRGB(0x003399);
    colorFadeTo(colorVarAsp);
};
aspiration_mc.onRollOut = function():Void {;
    colorFadeAway(colorVarAsp);
};

```

It fades in correctly when you mouse over but when you mouse out it turns to a black color when it should be turning blue. Not sure why.

😛  
Daf
