加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Flex4 uint颜色值和16进制颜色互转

发布时间:2020-12-15 03:45:55 所属栏目:百科 来源:网络整理
导读:? ? ?xml version="1.0" encoding="utf-8"?mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="433" width="397"mx:Script ![CDATA[private function convertUintToString():void{var xx:uint = new uint(uint_txt.text);result_hexadecimal

?

?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="433" width="397">
	<mx:Script> 
		<![CDATA[
			private 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: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:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读