I am trying to copy an image.
The green stuff on the first image is a mask (which is not set, its just there to show it)
Everything works fine when I dont set a mask to an image (picture 1)
But when I set the mask I get picture 2.
What I want is to copy a part of the image which is visible when the mask is set. I know what size the mask and image are going to be so I can calculate the size of the area which i need to copy.
This is the code I am using, image has registration point in the center, thats why i use matrix.translate (not sure if its the right way).
Also there is no image scaling applied (there might be later), thats why I am using matrix.scale.
var _reflectionHolder:Sprite = new Sprite();
addChild(_reflectionHolder);
_reflectionHolder.y =_targetObject.y + _targetObject.height / 2 + 10;
var _bitmapData:BitmapData = new BitmapData(_targetObject.width, _targetObject.height, true, 0x00000000);
var _matrix:Matrix = new Matrix();
_matrix.scale(_targetObject.scaleX, _targetObject.scaleY);
_matrix.translate(_targetObject.width/2,_targetObject.height/2);
_bitmapData.draw(_targetObject, _matrix);
var _reflectionBitmap:Bitmap = new Bitmap(_bitmapData);
_reflectionHolder.addChild(_reflectionBitmap);