A few days ago, I encountered the problem that flex needed to use uint to represent the color value,
After exploring the Internet for a long time, I wrote the following code for conversion,
Hope to help you!
<? Xml version = "1.0" encoding = "UTF-8"?> <Br/> <mx: Application xmlns: mx = "http://www.adobe.com/2006/mxml" height = "433" width = "397"> <br/> <mx: script> <br/> <! -- [CDATA [<br/> private function convertUintToString (): void <br/> {<br/> var xx: uint = new uint (uint_txt.text ); <br/> result_hexadecimal.text = xx. toString (16); <br/>}< br/> private function convertStringToUint (): void <br/>{< br/> var colorString: string = "0x" + hexadecimal_txt.text; <br/> var colorUint: uint = mx. core. singleton. getInstance ("mx. styles: IStyleManager2 "). getColorName (colorString); <br/> re Sult_uint.text = colorUint. toString (); <br/>}< br/> private function setColor (): void <br/>{< br/> result_final.text = pcolor. selectedColor. toString (); <br/>}< br/>] --> <br/> </mx: Script> <br/> <mx: label text = "uint and hexadecimal color conversion" color = "# F81E08" fontWeight = "bold" fontSize = "17"/> <br/> <mx: label text = "Enter the uint value:"/> <br/> <mx: TextInput id = "uint_txt"/> <br/> <mx: label text = "result: (hexadecimal color string):"/> <br/> <mx: TextInput Id = "result_hexadecimal"/> <br/> <mx: Button label = "OK" click = "convertUintToString ()"/> <br/> <mx: label text = "enter a hexadecimal color string:"/> <br/> <mx: TextInput id = "hexadecimal_txt"/> <! -- Text = "# {pcolor. selectedColor. toString (16)} "--> <br/> <mx: Label text =" result: (uint): "/> <br/> <mx: textInput id = "result_uint"/> <br/> <mx: Button label = "OK" click = "convertStringToUint ()"/> <br/> <mx: label text = "the most direct hexadecimal color to uint:"/> <br/> <mx: ColorPicker id = "pcolor" change = "setColor () "/> <br/> <mx: TextInput id =" result_final "/> <br/> </mx: Application>