簡體   English   中英

如何使MovieClip透明?

[英]how to make an MovieClip transparent?

我有這種情況:

有一些通用的動畫片段在背景中帶有某種顏色(可以是綠色,紅色等),我加載了一張圖像,並以與孩子相同的尺寸將它附加為一個孩子在該動畫片段中。

但是,如果此圖像具有一定的透明度,我可以看到背景(綠色,紅色等)。

我嘗試這樣:

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);
});

但這是行不通的。 而且我無法更改obj.alpha,因為在這種情況下我看不到圖像。 還有另一種方法嗎?

謝謝

您是否嘗試過Bitmapfill?

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM