PDA

View Full Version : convert RGB dec into hex


jacoflash
05-05-2005, 09:18 AM
hello

i am using a percentage type script that convert the width and height of an movieclip as a percentage out of 255.

So now i trace these properties of the movieclip and get the value out of 255, so I should now be able to use this information to set the color of another movieclip only problem is I dont know how to convert the decimal value into a hexadecimal one.

for example I have:

rgb = r + ","+g+","+b;
this will typically return something like -> 255,128,200

how do i get this back to a hex value?

thanx in advance

senocular
05-05-2005, 11:17 AM
hex = r<<16 | g<<8 | b;

jacoflash
05-06-2005, 08:28 AM
thanx, that worked cool using bitwise operator but have another problem now.

now im trying to change the hue of the image, how do i do this in actionscript?

as i understand it color consists out of red green and blue, so what is hue then exactly (like in photoshop) and how do i change it in flash?


thanx in advance

senocular
05-06-2005, 10:54 AM
You dont have the same control over color in Flash as you do in Photoshop. What you might want to do is try playing with the advanced color settings available to selections on the main timeline. Those options directly relate to the properties available in Color's setTransform. You can also check out proto.layer51.com for color functions that might help.