[flexcoders] Re: ColorPicker.selectedColor to #hex

2008-07-24 Thread Doug Lowder
Check out Number.toString(). You can pass it a radix parameter of 16 to convert the output to hex. --- In flexcoders@yahoogroups.com, Merrill, Jason [EMAIL PROTECTED] wrote: I don't mean for this to be a cross-post, I sent it to Flashcoders accidentally. This must have been done many times

[flexcoders] Re: ColorPicker.selectedColor to #hex

2008-07-24 Thread Merrill, Jason
Thanks guys, here was my solution: public static function decimalToHexidecimal(number:Number, upperCase:Boolean=false, addPound:Boolean=false, addOx:Boolean=false ):String { var hexString:String = Number(number).toString(16); while (hexString.length 6) hexString = 0 + hexString;

[flexcoders] Re: ColorPicker.selectedColor to #hex

2008-07-24 Thread Doug Lowder
Cool. Here are a couple other ways to pad the 0's, for anyone with an aversion to loops: hexString = 00.substr(0, 6 - hexString.length) + hexString; or: var pads: Array = [00, 0, , 000, 00, 0, ]; hexString = pads[hexString.length] + hexString; --- In

RE: [flexcoders] Re: ColorPicker.selectedColor to #hex

2008-07-24 Thread Alex Harui
@yahoogroups.com Subject: [flexcoders] Re: ColorPicker.selectedColor to #hex Cool. Here are a couple other ways to pad the 0's, for anyone with an aversion to loops: hexString = 00.substr(0, 6 - hexString.length) + hexString; or: var pads: Array = [00, 0, , 000, 00, 0