flex 颜色值uint与16进制的转换
本文转载自:
http://blog.csdn.net/sixingbugai/article/details/6645326?
? <?xml version="1.0" encoding="utf-8"?> ???private var today:Date; ???private var YMD:Date; ???private var datoptions:Array = new Array(); ??import mx.controls.Alert; ?public function convertUintToString():void? ??????????? {? ??????????????? var xx:uint = new uint(uint_txt.text);? ??????????????? result_hexadecimal.text = xx.toString(16);? ??????????? }? ??????????? private function convertStringToUint():void? ??????????? {? ??????????????? var colorString:String = "0x" + hexadecimal_txt.text;? ??????????????? var colorUint:uint? = mx.core.Singleton.getInstance("mx.styles::IStyleManager2").getColorName( colorString );? ??????????????? result_uint.text = colorUint.toString();? ??????????? }? ??????????? private function setColor():void? ??????????? {? ??????????????? result_final.text = pcolor.selectedColor.toString();? ??????????? }? ??]]> ?</mx:Script> ?<mx:HBox width="100%" ??? horizontalAlign="center" ??? paddingTop="20"> ?<mx:Label text="uint和16进制颜色互转" color="#F81E08" fontWeight="bold" fontSize="17"/>? ??? <mx:Label text=" 请输入uint值:"/>? ??? <mx:TextInput id="uint_txt"/>? ??? <mx:Label text="结果为(16进制颜色字符串):"/>? ??? <mx:TextInput id="result_hexadecimal"/>? ??? <mx:Button label="确定" click="convertUintToString()"/>? ??? <mx:Label text=" 请输入16进制颜色字符串:"/>? ??? <mx:TextInput id="hexadecimal_txt"/><!--text="#{pcolor.selectedColor.toString(16)}"-->? ??? <mx:Label text="结果为(uint):"/>? ??? <mx:TextInput id="result_uint"/>? ??? <mx:Button label="确定" click="convertStringToUint()"/>? ??? <mx:Label text="最直接的16进制颜色转uint:"/>? ??? <mx:ColorPicker id="pcolor" change="setColor()"/>? ??? <mx:TextInput id="result_final"/>? ?</mx:HBox> </mx:Application> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |