Created
January 6, 2009 09:19
-
-
Save mnowakowski/43740 to your computer and use it in GitHub Desktop.
convert int to hex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// convert some user ID (int) in to special unique hex color | |
function convertIdToHex(val:int):String{ | |
return '#' + ('00000' + (val * 999999).toString(16).toUpperCase()).substr(-6); | |
} | |
trace(convertIdToHex(1)) | |
trace(convertIdToHex(2)) | |
trace(convertIdToHex(3)) | |
trace(convertIdToHex(4)) | |
trace(convertIdToHex(5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment