我如何随意设置颜色为影片剪辑中的ActionScript3 [英] How do I randomly set the color for a MovieClip in actionscript3

查看:139
本文介绍了我如何随意设置颜色为影片剪辑中的ActionScript3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想随意设置颜色为影片剪辑在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.

这篇关于我如何随意设置颜色为影片剪辑中的ActionScript3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆