AS3 Convert a Hex Color (integer) to a CSS Color (string)


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function hex2css(color:int):String
  2. {
  3. return "#" + color.toString(16).toUpperCase();
  4. }
  5.  
  6. var myColour:int = 0xFF6699;
  7. trace(hex2css(myColour));
  8. // OUTPUT: #FF6699

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.