- Renamed class from Color to ColorName
- Changed package to yourpalmark
- hexValue property has been renamed to color
- Added a toString method to trace out the properties of the ColorName object
- Changed license from New BSD to MIT
One small thing I’ve always found a bit handy with CSS in XHTML is the ability to type familiar names for colors rather than the hex value.
Unfortunately, Flash’s StyleSheet does not support color names at all and Flex’s StyleManager only supports the 16 basic VGA color names.
I decided to write a class that adds static properties for all of the color names defined by SVG 1.0 (The colors in SVG 1.0 include the X11 colors with the addition of gray/grey variants. X11 includes the 16 basic VGA, or HTML4, colors as well). This class also adds two static convenience methods for returning a ColorName object by passing in the color name or hexadecimal color value.
While this class does not extend the CSS parsing capabilities of Flash, it could be used by an advanced StyleSheet class that overwrites the parseCSS method using this class as a lookup.
This class could also be extended to add (or overwrite) color values specific to a project you are working on. By setting up static properties for a project color set, the project team could be assured that the colors being used are consistent between team members.
Description:
The ColorName class defines the names and hexadecimal values of the colors defined in SVG 1.0.
Documentation:
ColorName Class Documentation
When you create a new Flex or ActionScript project in Flex Builder you are immediately able to access local files (config XML, etc) and internet resources at the same time.
But if you decide to import a project, or move or rename your current project suddenly you’re prompted with the dreaded Security Sandbox Violation: Security Error: Error #2148.
I’ve had this happen in the past, but often I was just loading a local XML file and I would just add -use-network=false as a compiler argument and all would be happy.
This however will then prevent you from accessing resources from the internet presenting you with yet another Security Sandbox Violation: Security Error: Error #2028. Not a great solution.
Lo and behold, Jesse Warden has the fix.
But to quickly recap, when Flex Builder creates a new project, it adds a new line item to two files giving permission to the new project’s bin directory to access both local and internet resources.
Here is the location of the two files (flexbuilder.cfg and flexbuilder.fbr):
PC:
C:\Documents and Settings\[username]\Application Data\Macromedia\Flash Player\#Security\FlashPlayerTrust
Mac:
[user]:Library:Preferences:Macromedia:Flash Player:#Security:FlashPlayerTrust
Now just add a new line item to each file (copying the one above if necessary) and change the paths to match your project’s bin or bin-debug directory.
Done.