I’m trying to fade three opaque circles when a user moves their mouse over them and then fade them back to normal on mouse out.
My current code will fade one of them (I’ll add the others once I’ve got this one working), but it fades them to the wrong colour, a lighter blue instead of orange, and I’m not sure why!? It also won’t fade them back to their original color.
Could anyone have a quick look and see if they can spot where I’m going wrong?
The fact that the trace of the colour values return either undefined or 0 in both fades has to mean something in my code isn’t working. lol.
import mx.transitions.Tween;
import mx.transitions.easing.*;
pop_mc._visible = false;
function colorFadeTo(object_mc:Color):Void {
var trans:Object = object_mc.getTransform();
//fade to orange
var ra:Tween = new Tween(trans, "ra", Strong.easeOut, trans.ra, 255, 3, true);
var ga:Tween = new Tween(trans, "ga", Strong.easeOut, trans.ga, 153, 3, true);
var ba:Tween = new Tween(trans, "ba", Strong.easeOut, trans.ba, 51, 3, true);
//trace("offsets "+trans.ra + " " + traces.ga + " " + trans.ba);
ra.onMotionChanged = function():Void {
object_mc.setTransform(trans);
};
};
function colorFadeAway(object_mc:Color):Void {
var trans:Object = object_mc.getTransform();
//fade to orange
var ra:Tween = new Tween(trans, "ra", Strong.easeOut, 255,trans.ra, 3, true);
var ga:Tween = new Tween(trans, "ga", Strong.easeOut, 153, trans.ga, 3, true);
var ba:Tween = new Tween(trans, "ba", Strong.easeOut, 51, trans.ba, 3, true);
trace("offsets "+trans.ra + " " + traces.ga + " " + trans.ba);
ra.onMotionChanged = function():Void {
object_mc.setTransform(trans);
};
};
// Aspiration Cirlc
aspiration_mc.onRollOver = function():Void {
var colorVarAsp:Color = new Color(aspiration_mc.background_mc);
colorVarAsp.setRGB(0x003399);
colorFadeTo(colorVarAsp);
};
aspiration_mc.onRollOut = function():Void {
colorFadeAway(colorVarAsp);
};
Many Thanks,
Daf