首页 > 代码库 > [ActionScript 3.0] 获取随机颜色

[ActionScript 3.0] 获取随机颜色

import flash.display.MovieClip;
import flash.geom.ColorTransform;

//方法一
var red:Number = Math.random() * 255 - 255;
var blue:Number = Math.random() * 255 - 255;
var green:Number = Math.random() * 255 - 255;
mc.transform.colorTransform = new ColorTransform(1,1,1,1,red,green,blue);

//方法二
var ct:ColorTransform = new ColorTransform();
ct.color = Math.random() * 0xffffff;
mc.transform.colorTransform = ct;

 

[ActionScript 3.0] 获取随机颜色