Skip to main content
Inspiring
September 14, 2011
Answered

Please HELP! Hex Color Code MovieCLip

  • September 14, 2011
  • 1 reply
  • 1970 views

Hi!

How can i get the hex color code of a movieclip?

Thanks a lot!

This topic has been closed for replies.
Correct answer Ned Murphy

To do it at runtime you can use something like the following, where mc representa whatever the instance name of your movieclip is...

import flash.display.BitmapData;

var bmd:BitmapData = new BitmapData(mc.width,mc.height);
bmd.draw(mc);
var pixelValue:uint = bmd.getPixel(1, 1); // specify a point where the color is
trace(pixelValue.toString(16)); // this outputs the hex color value

1 reply

Ned Murphy
Legend
September 14, 2011

What does the movieclip look like?  If it is one solid color, then you should be able to select the color picker in Flash and use it to pick the color from the movieclip.

Inspiring
September 14, 2011

Sorry, i didnt explain good,

i need to get the value at runtime in as3.

Ned Murphy
Ned MurphyCorrect answer
Legend
September 15, 2011

To do it at runtime you can use something like the following, where mc representa whatever the instance name of your movieclip is...

import flash.display.BitmapData;

var bmd:BitmapData = new BitmapData(mc.width,mc.height);
bmd.draw(mc);
var pixelValue:uint = bmd.getPixel(1, 1); // specify a point where the color is
trace(pixelValue.toString(16)); // this outputs the hex color value