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

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 and adapted it for my task, but I can’t get it fully working.


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:

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

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