[SIZE=1][SIZE=2]Hi, I’ve encountered a really strange problem and after nearly an hour of poking around I’ve finally pinned the source of the problem to colorTransform.
to see what I’m talking about create the following quick example:
1 open a new as3 fla file
2 draw a red circle and convert it to a movie clip symbol called Circle, choose export for ActionScript under Linkage.
3 right click the Circle in the library and choose edit.
4 select all, convert to another movieclip symbol called fill. so now Circle has a child movieclip. select the child movieclip and give it the name “fill”
5 still in edit window of Circle, insert 2 key frames, one at frame 5 and the other at frame 10. scale the instance of fill in frame 5 by 150%.
we are done, what we’ve created is basically red circle that will expand then shrink constantly.
now add the following code in frame1 of the main timeline
var c1:Circle = new Circle();
var c2:Circle = new Circle();
c1.x = c1.y = 100;
c2.x = c2.y = 200;
addChild(c1);
addChild(c2);
var blue:ColorTransform = new ColorTransform(0,0,0,1,0,0,255,0);
c2.fill.transform.colorTransform = blue;
at this point if you test movie you’ll see 2 circles on screen, 1 red and 1 blue. the red circle plays it’s animation as expected but the blue circle doesn’t.
so after fill’s color has been changed by using colorTransform, the movieclip stopped working. this only happens if fill is a child movieclip. if you changed the parent’s color by:
[/SIZE][/SIZE][SIZE=1][SIZE=2]c2.transform.colorTransform = blue;
then the animation plays correctly. but the problem with that is the color of every child will be changed to blue.
so what’s going on here? is it a bug or a side effect of transform? this behavior of colorTransfom is so unexpected that it took me ages to identify the problem
[/SIZE][/SIZE]