Tiago Peczenyj
Tiago Peczenyj

Reputation: 4623

how to make an MovieClip transparent?

I have this situation:

there is some generic movieclip with some color in background (can be green, red, etc), and I load one image and attach in this movieclip as a child, using the same dimensions of the movieclip.

But if this image has some transparency I can see the background ( green, red, etc).

I try this:

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event){
var tempImage:Bitmap = new Bitmap(e.target.content.bitmapData);
image.bitmapData = tempImage.bitmapData;

obj.graphics.beginFill(0xFFFFFF, 0);
obj.graphics.drawRect(0,0,obj.width, obj.height);
obj.graphics.endFill();

obj.addChild(image);
});

But it is not working. And I cant change the obj.alpha because I cant see the image in this case. There is another way?

Thanks

Upvotes: 1

Views: 499

Answers (1)

Gone3d
Gone3d

Reputation: 1189

Have you tried Bitmapfill instead?

loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event){

    obj.graphics.beginBitmapFill(e.target.content.bitmapData);
    obj.graphics.endFill();
});

Upvotes: 1

Related Questions