hello, I'm very new to AS3.0 and I have problems with alpha. The next code is from my animation class and its main purpose is draw frame to other bitmapdata object.
The thing is that when I use copyPixels, the frame loses its alpha value. For example if I do new bitmap object from destBitmapData and addChild it, then the alpha remains, but not when I use copyPixels :DCode:// Copy the frame from original BitmapData.
destBitmapTempData.copyPixels(bitmapData, rect, zeroPoint);
// Set the newly copied BitmapData to Bitmap.
modifiedBitmap.bitmapData = destBitmapTempData;
// Change alpha
modifiedBitmap.alpha = 0.5;
// Get Matrix from the modifiedBitmap.
matrix = modifiedBitmap.transform.matrix;
// Change it if necessary
if (flipHor)
{
matrix.scale( -1, 1);
matrix.translate(width, 0);
}
if (flipVer)
{
matrix.scale( 1, -1);
matrix.translate(0, height);
}
// Clear previous frame.
destBitmapData.fillRect(zeroRect, 0x00000000);
// Draw the new frame.
destBitmapData.draw(modifiedBitmap, matrix);
// Copy the new frame to canvas.
canvasBD.copyPixels(destBitmapData, zeroRect, position, null, null, true);
The canvasBD is created:
Any ideas how do I get alpha remain to that frame? :)Code:canvasBD = new BitmapData(screenRect.width, screenRect.height, true, 0x00FFFFFF);
