设置mc的颜色
方法一:
var colorTransform:ColorTransform = $mc.transform.colorTransform;
colorTransform.color = $color;
$mc.transform.colorTransform = colorTransform;
方法二:
var color:ColorTransform=new ColorTransform();
color.redMultiplier=0;
color.greenMultiplier=0;
color.blueMultiplier=0;
color.alphaMultiplier=0;
color.redOffset=255;
color.greenOffset=0;
color.blueOffset=255;
color.alphaOffset=255;
mc.transform.colorTransform=color;
方法三:
mc.transform.colorTransform=new ColorTransform(0.5,0,0,1);
mc.transform.colorTransform=new ColorTransform(0x256256);
///
/创新思维-----
//控制颜色的一个方法:
//设置颜料盒
var cl:ColorTransform=new ColorTransform;
//随机产生一个16进制的数,在0-244之间
cl.color=0xffffff*Math.random();
//涂色
myMc_mc.transform.colorTransform=cl;
var colorMc:ColorTransform=new ColorTransform();
colorMc.color=0x256256;
//设置color属性后会自动把redMultiplier等这三个属性值设为0,因此为了看到MC中的图片还需要设置成1.
colorMc.redMultiplier=1;
colorMc.greenMultiplier=1;
colorMc.blueMultiplier=1;
var targetMc:man01=new man01(); //一个MC
targetMc.transform.colorTransform = colorMc;
addChild(targetMc);
方法一:
var colorTransform:ColorTransform = $mc.transform.colorTransform;
colorTransform.color = $color;
$mc.transform.colorTransform = colorTransform;
方法二:
var color:ColorTransform=new ColorTransform();
color.redMultiplier=0;
color.greenMultiplier=0;
color.blueMultiplier=0;
color.alphaMultiplier=0;
color.redOffset=255;
color.greenOffset=0;
color.blueOffset=255;
color.alphaOffset=255;
mc.transform.colorTransform=color;
方法三:
mc.transform.colorTransform=new ColorTransform(0.5,0,0,1);
mc.transform.colorTransform=new ColorTransform(0x256256);
///
/创新思维-----
//控制颜色的一个方法:
//设置颜料盒
var cl:ColorTransform=new ColorTransform;
//随机产生一个16进制的数,在0-244之间
cl.color=0xffffff*Math.random();
//涂色
myMc_mc.transform.colorTransform=cl;
var colorMc:ColorTransform=new ColorTransform();
colorMc.color=0x256256;
//设置color属性后会自动把redMultiplier等这三个属性值设为0,因此为了看到MC中的图片还需要设置成1.
colorMc.redMultiplier=1;
colorMc.greenMultiplier=1;
colorMc.blueMultiplier=1;
var targetMc:man01=new man01(); //一个MC
targetMc.transform.colorTransform = colorMc;
addChild(targetMc);