把图片变成渐变透明(左图是效果图,右图是原图)
var a:Sprite = new Sprite(); a.graphics.beginGradientFill(GradientType.LINEAR, [0xff0000,0xff0000], [1,0.3], [0, 255]); a.graphics.drawRect(0, 0, 240, 225); a.graphics.endFill(); addChild(a); a.rotation = 90; a.x = 226; aaa.mask = a; a.cacheAsBitmap = aaa.cacheAsBitmap = true; //这里是必须的,否则mask没有渐变效果,只是普通的当纯色一样。