1

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));
Cœur
  • 37,241
  • 25
  • 195
  • 267
Shahbaz Pothiawala
  • 1,175
  • 5
  • 20
  • 38

2 Answers2

3

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.

akmozo
  • 9,829
  • 3
  • 28
  • 44
0

I figured it out myself. To get the color of the movieclip this way, it should have a tint. Only then it works.

Shahbaz Pothiawala
  • 1,175
  • 5
  • 20
  • 38