Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rgbToHex function

Status
Not open for further replies.

snakehips2000

Programmer
Nov 10, 2003
95
GB
Can anyone tell me what replaced the Actionscript1 "rgbToHex" function in Actionscript2?

i.e.

Math.rgbToHex = function(r,g,b){
return(r<<16 | g<<8 | b);
}

returns a syntax error in AS2, but compiles fine in AS1.
 
I would do something like this:

[tt]//
function rgbToHex(r:Number, g:Number, b:Number) {
return (r << 16 | g << 8 | b).toString(16);
}
//
trace(rgbToHex(23, 46, 92));
//

172e5c[/tt]

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top