<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
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>