Sunday, April 6, 2008

Cannot create property ColorTransform on flash.geom.Transform

Ok, here was a weird one. I was trying to change the color of a movieclip at runtime -- which could be done with setRGB() in actionscript 2. So I did this to match the new AS3 approach:

import flash.geom.ColorTransform;

var myCT:ColorTransform = new ColorTransform();
myCT.color = 0x8e5823;

myMovieClip.transform.ColorTransform = myCT;
But when I run this I got this error:

"Cannot create property ColorTransform on flash.geom.Transform"

After pulling my hair out (just for a bit) I found that I had capitalized the colorTranform property of the MovieClip. Once I changed the last line to this:
myMovieClip.transform.colorTransform = myCT;
...it worked fine. But since I didn't get any Google result for that error I figured I would put this in.

Simple mistake but very annoying ;-)

1 comment: