Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hexadecimal addition 1

Status
Not open for further replies.

Bignewbie

Programmer
Joined
Feb 22, 2001
Messages
351
Location
PH
guys,

I have been trying to do this for an hour now. Is there a way (in actionscript) to add 2 hexadecimal numbers (e.g. 00ee11+00ff10) without converting it to decimal first?


Please help!


thanks in advance

biggie



The Man of Tomorrow is forged by his battles today.
 
You need to prefix the numbers with '0x' to tell Flash they're hex then encode the result to hex using 'toString(16) otherwise the result will be treated as decimal.

Code:
var result = 0xee11+0x11dd;
trace(result.toString(16));[code]
 
thanks wangbar!

i didn't think it could be done that way. Thanks again!



biggie



The Man of Tomorrow is forged by his battles today.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top