New Extension: Send Colors from InDesign and Illustrator to Flash

Following the merge text extensions for Flash, Illustrator, and InDesign, Keith Gilbert wrote me wondering about getting swatch information from InDesign to Flash via XFL or by way of importing an Adobe Swatch Exchange (ASE) file into the Flash swatches panel. There are several stumbling blocks in the way of such an extension. First, finding a way for extendscript or JSFL to read the contents of an ASE file (which is not open source and not plaintext) proves to be quite difficult. Second, JSFL (the Flash scripting language) doesn’t have any access (currently) to the swatches panel.

BREAKING NEWS (12/6/08): I noticed that the new Kuler extension for Flash CS4 has an “add to swatches” button, and it actually adds swatches to the swatches panel. After some decompiling and a lot of detective work, I found an undocumented JSFL call that was added to CS4. The feature is undocumented for a reason: it sends encoded XML data, and if the data is faulty, it crashes Flash. I have a few test cases working and I’m confident that I can add it to this extension, so the swatches will go right in the Flash swatches panel, rather than onto the stage, though it will only work in CS4. Be on the lookout for an update in the next few days.

UPDATE (12/7/08): Updated to version 1.1.0. If you have Flash CS4, the swatches will now go right into your Flash Swatches panel. Hooray!

There does seem to be a lot usefulness to such an extension, since XFL creates a new workflow between InDesign and Flash, and the Illustrator importer for Flash is fantastic, but neither one loads any of the swatches from the original document. I’ve certainly spent my fair share of time opening up the swatch properties, making sure the swatch is RGB or hex and copying all three fields one at a time.

So, I decided to plow ahead and see what I could come up with. The results are below. This extension takes the swatches from your current InDesign or Illustrator document and sends them to a new layer on the Flash stage. You can then use the eyedropper to pick up the colors, or you can add them to your swatches panel individually (similar to this demo of the Kuler panel).
UPDATE (12/7/08): If you have Flash CS4, you can skip the step above. Version 1.1.0 of this extension will send the Illustrator or InDesign swatches right to your swatches panel in Flash.

This extension will transfer spot and process colors of all varieties (RGB, CMYK, LAB, HSB). Rather than converting the CMYK with my own function, I used the applications themselves to convert the colors to RGB for Flash, so the transfer fidelity is quite good. It will ignore gradients, tints, patterns and fancy stuff like that. If you want to get your gradients into Flash see the bonus tip below.

InDesign to Flash CS4

Or, here’s what InDesign to Flash CS3 would look like.

Illustrator to Flash CS4

Or, here’s what Illustrator to Flash CS3 would look like.

Downloads and more below the fold.



JSX file:

  1. Place the JSX file into the appropriate directory:

InDesign CS3/CS4 > {application directory**}/Scripts/Scripts Panel
Illustrator CS3 >  {application directory**}/Presets/Scripts
Illustrator CS4 >  {application directory**}/Presets/{language/region}/Scripts

**Application Directories:
Windows > C:\Program Files\Adobe\{application name + version}\
Mac OS X > Applications/{application name + version}/

MXP file (CS4 only):

  1. Double-click on the MXP file to install using Adobe Extension Manager CS4.


InDesign: make sure the scripts panel is open, Windows > Automation > Scripts, locate the Send Swatches to Flash.jsx script and double-click to run the script. If you installed the script using the MXP file, the script with be in the Ajar Productions subfolder.

Illustrator: Select Send Swatches to Flash from the File > Scripts menu.

Bonus Tip: Transferring Gradients

You can get a gradient from Illustrator to Flash by applying the gradient to a rectangle, copying the rectangle and pasting into Flash (CS3 or later). A dialog box will appear in Flash, make sure “Paste using AI File Importer preferences” is selected and it will retain you vector artwork, including the gradient! To get the gradient from InDesign to Flash, create the rectangle with the gradient in InDesign, copy and paste it into Illustrator, then copy and paste it into Flash using the instructions in the previous sentence.



Get updates from Ajar Productions

Sign up today and get the InDesign Split Text premium extension for free!

Unsubscribe at any time. Powered by ConvertKit