PDA

View Full Version : ColorTransform


mike05
11-06-2009, 06:01 PM
I'm looking back at some of my old code and I can't seem to figure out why this works....

var myShapeColour:uint = 0x000000;
var myColour:ColorTransform;
myColour = shape_mc.transform.colorTransform;
myColour.color = myShapeColour;
shape_mc.transform.colorTransform = myColour;

Doesn't it seem redundant?

Can someone explain how the colorTransform works?

henke37
11-06-2009, 06:37 PM
It must be one of those "update only on direct assignment" properties that only reads the values once.

abeall
11-06-2009, 07:56 PM
Yes, as henke37 said, the .colorTransform property cannot be updated by simply changing its properties, it has to be completely re-assigned. That is redundant logically, but internally when you get a reference to .transform.colorTransform you get a copy of the object, not a reference. AS3 is pretty inconsistent in what properties behave like that, for instance .transform.matrix is a copy, but .transform.matrix3D is a reference. Go figure.

mike05
11-06-2009, 08:43 PM
Thanks guys, yeah it was just weird to look at it and wrap my head around it. Thanks again!