开发者

Can I have variable (linear gradient) transparency for a Flex UI Container

开发者 https://www.devze.com 2022-12-24 13:20 出处:网络
I would like to have a variable transparency for a Flex UI container. The upper half of the container should be completely opaque but the lower part of it should smoothly change from completely opaque

I would like to have a variable transparency for a Flex UI container. The upper half of the container should be completely opaque but the lower part of it should smoothly change from completely opaque 开发者_如何学Goto completely transparent.

Any ideas how to achieve it?

Thanks


You can use a gradient fill to achieve this.

var fillType:String = GradientType.LINEAR;
var colors:Array = [0xffffff, 0xffffff];
var alphas:Array = [1, 0];
var ratios:Array = [127, 255];
var mat:Matrix = new Matrix();
mat.createGradientBox(bkg.width, bkg.height, 90, 0, 0);

bkg.graphics.beginGradientFill(GradientType.LINEAR, colors, alphas, 
         ratios, mat, SpreadMethod.PAD);  

bkg.graphics.drawRect(0, 0, bkg.width, bkg.height);
0

精彩评论

暂无评论...
验证码 换一张
取 消