Search code examples
actionscript-3flashapache-flexhexflex4

Convert text string to hexadecimal using flash builder


I want to convert MAC Address into hexadecimal string using flash builder.. I used this code

var networkInterface : Object =  NetworkInfo.networkInfo.findInterfaces();
var networkInfo  : Object = networkInterface[0];
var physicalAddress : String = networkInfo.hardwareAddress.toString();

txtreq.text = physicalAddress + "-" + txtserial.text

var reqcode:uint = uint(txtreq.text);

var reqcode1:String = reqcode.toString(16);

txtact.text = reqcode1;

When I run the application,

txtserial.text = 123 and physicalAddress = C6-17-31-A9-EF-FF...

but txtact.text got 0.

Then how I fix the problem and In flex Builder how I convert FF-FF-FF-FF-FF like text into hexadecimal code...


Solution

  • You should use parseInt(reqcode,16) instead of reqcode.toString(16);