我想随意设置颜色为影片剪辑在ActionScript 3,我怎么会去这样做?
I want to randomly set the color for a MovieClip in ActionScript 3. How would I go about doing so?
示例在一个阵列的一些颜色:
var colorArray:Array = new Array(0xFFFF33, 0xFFFFFF, 0x79DCF4, 0xFF3333, 0xFFCC33, 0x99CC33);
var randomColorID:Number = Math.floor(Math.random()*colorArray.length);
var myColor:ColorTransform = this.transform.colorTransform;
myColor.color=colorArray[randomColorID];
myMovieClip.transform.colorTransform = myColor;
更改myMovieClip实例名称OOF影片剪辑,如果你愿意,你可以添加一个click事件来改变随机颜色。
Change the myMovieClip to the instance name oof your movie clip, if you want you could add a click event to change the random colors.