views:

120

answers:

1

I've got a movieclip with two layers - a background movieclip, and above that, a mask movieclip (as you might guess, this layer is masking the first). Due to design necessity, the mask is animated on the timeline across 60 frames.

The problem arises when I use an Event.RESIZE listener to change the width of the parent movieclip when the browser window is resized. Any code to reference the mask, i.e

parentMC.contentMask.width = stage.stageWidth; parentMC.contentMask.x = frame.width/2 - frame.contentMask.width/2;

Simply results in the mask animation not playing at all. Are there any solutions to this problem (I have searched numerous sites for this, but it may be I've overlooked something incredibly obvious).

Many thanks.

A: 

You have not overlooked anything obvious. Unfortunately you just can't affect a timeline tween via code. However there is a way to deal with the issue. You need to put the timeline tweened mask inside another movieclip. The downside to this is that you can no longer scrub the timeline to see the effect. But, at least this approach works. If this doesn't make sense let me know. Typing from my phone so not explaining as good as I probably should.

EDIT

Ok, so to explain a bit better (now at a computer) you need to nest your tween in an additional movieclip. So, your tween will actually be in another non-tweened movieclip with a stop on the first frame. When you want to show your tween you will need to do something like mask_mc.play(). Now you will be able to do things like mask_mc.width = 500;... etc.

sberry2A
Thanks, this worked a treat. Completely overlooked the possibility of using a containing movieclip. That's what you get from spending more time in TextMate than the IDE! :P
Peter Hughes