views:

202

answers:

2

I have a MovieClip that consists of multiple layers, one of those layers is an animated background Shape. let's call this MyMovieClip with the background shape have the instance name "mcBackground";

I'm adding the MovieClip to the stage from ActionScript by:

var myMovieClip = new MyMovieClip();
addChild(myMovieClip);

This works fine and when the movie clip is added to the stage it plays as expected (background is moving).

The problem is when I try to apply a colorTransform to the background shape, it stops from moving. what I'm doing is this inside the MyMovieClip class:

var ct:ColorTransform = mcBackground.transform.colorTransform;
ct.color = some color value;
mcBackground.transform.colorTransform = ct;

When I do this, the background is colored correctly, but it doesn't animate anymore, it seems to be stuck at frame 1 as far as displaying although any code I have in later frames is executed. So it looks like a display issue.

what's the problem here? Is changing transform.colorTransform possible to animated shapes?

let me know if the description is not clear and I'll try to explain more.

+2  A: 

generally, actionscript applied to any timeline-tweened object will break the tween. You can try to wrap your timeline with another clip, and apply the colorTransform to that clip.

doamnaT
Cool thanks, I didn't know that. Now I've wrapped the clip with another clip that does the animation, while the colorTransform is still applied to the original shape. and It works.
Moe Salih
A: 

Thanks also to doamnaT (I don't have enough rep to upvote yet). I've also found that in general dissociating timelines from the main timeline is good practice, which coincidentally avoids problems like this. Usually my main timeline is only one frame.

mVChr