simo
simo

Reputation: 24600

Draw shape on bitmapData, transparency lost

I am drawing a rounded rect into BitmapData: (bg)

var bg:Shape= new Shape();
bg.graphics.beginFill(0xdddddd);
bg.graphics.drawRoundRect(0, 0, 200, 400, 20);
bg.graphics.endFill();

var imageData:BitmapData = new BitmapData(bg.width, bg.height);
image.draw(bg);

But when I create a Bitmap from imageData the bitmap corners are not transparent as expected, instead its white color .. any idea?

Upvotes: 0

Views: 236

Answers (1)

Benjamin BOUFFIER
Benjamin BOUFFIER

Reputation: 946

try:

// see the argb color value 0x00000000 -> the first two '0' after '0x' are for transparency
var imageData:BitmapData = new BitmapData( bg.width, bg.height, true, 0x00000000 );

Upvotes: 2

Related Questions