问题
How to convert hex(in string) to decimal(int) in Actionscript3?
回答1:
Number, int and uint class having toString() method which accept radix as arguments.
radix Specifies the numeric base (from 2 to 36) to use for the number-to-string conversion. If you do not specify the radix parameter, the default value is 10.
you can convert to any base like octal, hex, binary via Number and uint class.
Better way
var decimal:int = parseInt("FFFFFF",16); // output : 16777215
Another way
var hex:String = "0xFFFFFF";
var hexint:int = int(hex); // output : 16777215
it is equivalent to
var hexint:int = int(hex).toString(10); //Decimal conversion
Back to original value :
var decimalStr:String = hexint.toString(16).toUpperCase(); // output : FFFFFF
来源:https://stackoverflow.com/questions/14659322/how-to-convert-hex-to-decimal-in-actionscript3