开发者

Changing the alpha with ColorTransform (tint + alpha)?

I am trying to change the alpha of a tint using the ColorTransform class, is开发者_JS百科 it possible to do this?

private function setColor(target:DisplayObject, color:uint, alpha:uint = 150) {
            var colorTransform = new ColorTransform();
            colorTransform.color = color;
            colorTransform.alphaOffset = alpha;
            target.transform.colorTransform = colorTransform;
        }

However, when I try to use it with say,

setColor(this, 0x333333, 100);

I seem to get a solid dark grey instead of a partially transparent tint?


Use alpha alphaMultiplier instead of alphaOffset. When you use alphaOffset, it add alpha, so if alpha is already at 100% you won't see any transparency.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜