I'm trying to use ActionScript to control color ransformations for my background image in a movie that I'm making. Rather than actually animate the different combinations of color transitions by hand, I want to use AS to check to see what the color that I want to change the background to is, and then slowly change the color to match.

I can use setTransform to do that, but it changes the color in one frame, so I'm trying to make the transition gradual with the following code:

code:

onClipEvent(load) {
cVarR = 0;
cVarG = 0;
cVarB = 0;
}

onClipEvent(enterFrame) {
newcVarR = -100;
newcVarG = 80;
newcVarB = 120;
if (newcVarR < cVarR) {
cVarR = cVarR - 20;

} else if (newcVarR > cVarR) {
cVarR = cVarR + 20;

}

if (newcVarG < cVarG) {
cVarG = cVarG - 20;

} else if (newcVarG > cVarG) {
cVarG = cVarG + 20;

}

if (newcVarB < cVarB) {
cVarB = cVarB - 20;

} else if (newcVarB > cVarB) {
cVarB = cVarB + 20;

}var oNewColor:Object = new Object();
oNewColor.rb = cVarR;
oNewColor.gb = cVarG;
oNewColor.bb = cVarB;
var cPict:Color = new Color(pict);
cPict.setTransform(oNewColor);
trace(cVarR+" , "+cVarG+" , "+cVarB);
}



...and I'm having no luck. This code is placed in the movie clip that I want to change the color on, but it doesn't do anything. The trace command shows the variables stepping incrementally from 0 (the value that I defined for each of the cVar colors at onLoad) to the value that I declared in newcVar(color), but the color itself doesn't change.

This is driving me up the wall, here.

I appreciate any help you guys can offer.