Hello all,
I have an image and I want to flip it horizontally. The source image is a png
with a transparent background and I find that the flipped image losses the
transparency. How do I preserve it?
I am using the code below:
//flip horizontally
var transform:Matrix = new Matrix();
transform.scale(-1, 1);
transform.translate(sourceImage.width, 0);
//create a new bitmap based on source with transformation
var _newBitmap:BitmapData = new BitmapData(sourceImage.width,
sourceImage.height, true);
_newBitmap.draw(sourceImage, transform);
var displaySprite:Sprite = new Sprite();
displaySprite.graphics.beginBitmapFill(_newBitmap, null, false);
displaySprite.graphics.drawRect(0, 0, sourceImage.width, sourceImage.height);
Thanks,
- Ivo