|
|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
MXDJ TOP LINKS YOU MUST CLICK ON ! Flex News Desk
Converting Back and Forth Between Hexidecimal Strings and Numbers
It's really convenient for anyone coming from an HTML background that we can now provide colors to Flex
By: Jeff Tapper
Oct. 31, 2006 02:00 PM
Digg This!
It's really convenient for anyone coming from an HTML background that we can now provide colors to Flex using html standard syntax for hexidecimal number (#000000 = black, #ffffff= white, etc). I've recently been building some tools to convert drawings in the flash player to and from SVG format. SVG, like HTML, likes to specify hexidecimal numbers with a "#" prefix, but the flash player drawing API needs hexidecimal numbers to be prefixed with "0x" To help migrate back and forth between hexStrings and AS numbers, I wrote a few static methods, which are working well for me: package utils {As you can see, there are 2 methods hexStringToNumber and numToHexString. These can be used simply like this: var whiteNum:Number = Colors.hexStringToNumber ("#ffffff");
LATEST FLEX STORIES & POSTS
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||