Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1754
  • Last Modified:

How do I convert RGB numeric value to Hex in Actionscript 3?

Greetings Experts!

Can you please assist me with converting an RGB value to Hex?

For instance, I'm using getPixel(mc.mouseX, mc.mouseY) to return an RGB value - such as 16651277.  I would like to convert this number to hex.

What's the simplest method for handling this? Can I do a direct conversion of this RGB value to hex without breaking it down into its R, G, and B components?

Thanks!
0
bham3dman
Asked:
bham3dman
1 Solution
 
CyanBlueCommented:
You could use toString() function to do so...

CyanBlue
var dec:Number = 16651277;
var hex:String = dec.toString(16);
trace(hex);  // fe140d

Open in new window

0
 
bham3dmanAuthor Commented:
Ah...thanks for the help!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now