Posts Tagged ‘swatchloader’

Adobe Swatch Exchange (ASE) Files in AS3

SwatchLoader.as in action (click image for demo)

Download the AS3 Class: SwatchLoader.as
Source Code: View Source

SwatchLoader.as is an AS3 class for FP10 that loads Adobe Swatch Exchange (ASE) files into an object.  From this object you can access all group and color information for the swatch.  It handles RGB, CMYK, and grayscale color modes.

This demo was inspired by the work of Jerome at wemakedotcoms.com (AKA, elguapoloco at the Away3D dev list) who recently posted an Away3D site that used the Kuler RSS feed.  Sites like Kuler and ColourLovers provide community supported collections of free color swatches.  Though the idea of creating a swatch of 5 colors is simple, it acts as creative inspiration.  And as such I was inspired to use these swatches as themes or skins for future Flash projects.

kuler.adobe.com

Not wanting to be at the mercy of the RSS (Jerome mentioned that he had some responsiveness issues with it) I decided to write a parser for ASE.  While the format is relatively simple and can be used by almost any Adobe CS 3+ product, it is proprietary.  Fortunately I was pointed to this site, where the binary format of many image types can be found.  Armed with this second hand specification and my trusty hex editor, I churned out the finalized code in just a few hours.  Now it can successfully handle ASE formatted swatches from Kuler and ColourLovers.  In theory it should work for any ASE, but I have not yet tested it on anything but swatches from those 2 sites.

With a little luck (and free time) you’ll probably see this included in some of my demos in the near future.  Send a comment if you find it useful or if you run into any problems.

One last note, its not error that the ColourLovers’ swatch name is always “unknown.”  The ASE files generated by ColourLovers do not include the name of the swatch.