我想这是点击的影片剪辑的hexColor。我的影片剪辑是一个红色的圆圈纯色。于是就点击红圈的,它应该返回我为0xFF0000。我用的是下面的,但我没有得到期望的结果。它只返回我0。
I want the hexColor of the movieclip which is clicked. My movieclip is a red circle with solid color. So on click of the red circle, it should return me 0xff0000. I use the following but I do not get the desired result. It only returns me 0.
trace(redcircle.transform.colorTransform.color.toString(16));
我在哪里的问题呢?请支持你的答案用一张code。
Where am i going wrong? Please support your answer with a piece of code.
您也可以使用 BitmapData.getPixel()
让你的影片剪辑的颜色:
You can also use a BitmapData.getPixel()
to get the color of your MovieClip :
var bmpd:BitmapData = new BitmapData(mc.width, mc.height);
bmpd.draw(mc);
// supposed that your circle is at (0, 0)
var color:uint = bmpd.getPixel(mc.width/2, mc.height/2);
trace(color.toString(16)); // gives : ff0000
希望能有所帮助。
Hope that can help.