Tweening color animations with setTransform
Hello all,
I just wanted to briefly thank all of the experinced AS coders who are willing to help out the newcomers to actionscript; without all of their posts I'd be utterly lost, instead of merely somewhat lost as I am now.
So here's my question: I'm trying to get a piece of code that increments the values for setTransform to make a more gradual transition to a color than the one frame jump that it usually does.
I've got a random image on my stage that I have named "pict" and converted into a movie clip. Attached to the movie clip is the following code:
code:
onClipEvent(load) {
var oNewColor:Object = new Object();
oNewColor.rb = cVarR;
oNewColor.gb = cVarG;
oNewColor.bb = cVarB;
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 cPict:Color = new Color(pict);
cPict.setTransform(oNewColor);
trace(cVarR+" , "+cVarG+" , "+cVarB);
}
The trace function returns that the values are incrementing as I want, but the image itself never changes. I suspect this is more of me not getting the AS logic yet, since that's what's been bedeviling me.
Currently, and for the forseeable future, I am using MX 04. Someday, when I win the lotto, I'll buy 8. :P
As always, any information is much appreciated.
Pacem!
--T