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);
精彩评论