|
Comments
|
Today's Top SOA Links
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
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");
Reader Feedback: Page 1 of 1
Your Feedback
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 |
||||||||||||||||||||||||||||||