3

This works:

var a:BitmapData = new BitmapData(640,480);
var b:Bitmap = new Bitmap(a);
a.draw(movieClip);

This doesn't work:

movieClip.mask = movieClipMask;
var a:BitmapData = new BitmapData(640,480);
var b:Bitmap = new Bitmap(a);
a.draw(movieClip);

How can I draw just the visible part of a MovieClip (that uses a mask) into my Bitmap?

kontur
  • 4,934
  • 2
  • 36
  • 62
user534312
  • 91
  • 2
  • 7

1 Answers1

7

Create a new Sprite and add both the MovieClip and its mask to it. Then draw the parent Sprite.

var container:Sprite = new Sprite();
container.addChild (movieClip);
container.addChild (movieClipMask);
movieClip.mask = movieClipMask;

var a:BitmapData = new BitmapData(640,480);
var b:Bitmap = new Bitmap(a);
a.draw(container);
weltraumpirat
  • 22,544
  • 5
  • 40
  • 54
  • It works, but in final Bitmap: the movieClip position is different. The original I see a parte of the fullMovielip. In the Final Bitmap I see other part (I mean the mask is losing its position) – user534312 Feb 01 '12 at 14:27
  • The coordinates of both the mc and the mask must of course be relative to the container Sprite. Unless that is not the case, it should look the same. – weltraumpirat Feb 01 '12 at 14:39