Return to Snippet

Revision: 24238
at November 1, 2011 04:17 by adrianparr


Updated Code
function hex2css(color:int):String
{
	return "#" + color.toString(16).toUpperCase();
}

var myColour:int = 0xFF6699;
trace(hex2css(myColour));
// OUTPUT: #FF6699

Revision: 24237
at January 26, 2011 02:49 by adrianparr


Updated Code
function hex2css(color:int):String
{
	return "#" + color.toString(16).toUpperCase();
}

var myColour:int = 0xFF6699;
trace(hex2css(myColour));
// OUTPUT: #ff6699

Revision: 24236
at February 24, 2010 06:30 by adrianparr


Initial Code
function hex2css(color:int):String
{
	return "#" + color.toString(16);
}

var myColour:int = 0xFF6699;
trace(hex2css(myColour));
// OUTPUT: #ff6699

Initial URL

                                

Initial Description

                                

Initial Title
AS3 Convert a Hex Color (integer) to a CSS Color (string)

Initial Tags
css, color, convert

Initial Language
ActionScript 3