New Extension: Send Colors from InDesign and Illustrator to Flash

Justin | design,ExtendScript,extensions,Flash,Illustrator,InDesign,tips | Friday, December 5th, 2008

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.

Downloads

Installation

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.

Usage

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.

FYI

I’ve added a donate button to the bottom of the navigation on the right-hand side of the page. If you’d like to help us spend more time making stuff that we can share with you, you’re welcome to leave a tip. Paypal is not required to donate. Donations are not tax deductible.


13 Comments »

  1. [...] так же есть скрипт для экспорта Swatches между некоторыми приложениями Adobe: Send Colors from InDesign and Illustrator to Flash. [...]

    Pingback by DTP Craft » Blog Archive » Illustrator plugin: Combine Textfields — January 18, 2009 @ 8:50 pm

  2. i am trying to export my swatches from ill4 to flash4
    i have loaded your script into illustrator and when i use the script from ill. i get an error:

    Error 2: apps is undefined.
    Line: 27
    -> for(var i=apps.length-1; i>0; i–) {

    what does this mean?
    thank you

    Comment by adrian wolfson — January 19, 2009 @ 11:42 am

  3. Adrian, the variable “apps” is used to loop through and check for all versions of Flash, so the swatches can be sent to CS3 as well, if that’s the version of Flash that is open.

    I have yet to encounter this problem on any of my own machines, so I don’t know why the “apps” variable would be undefined.

    To fix: locate the script file, open it in a text editor, find the offending line, add a return before it, and paste this code:
    if(!this.hasOwnProperty("apps")) return "flash";

    Hopefully that should bypass the problem. Let me know how it works.

    If anyone else has this problem, please let me know, I’ll be sure to incorporate a fix into the next version.

    Comment by Justin — January 19, 2009 @ 7:15 pm

  4. wow, this is awesome! I’m having a problem similar to Adrian’s but not exactly. When I run the script in Illustrator, I get this error:

    Error 21: undefined is not an object.
    Line: 86
    -> var red =
    Math.round(rgbArray[0]).toString(16)

    do I have a color that’s defined wrong in Illustrator?
    -Kiki

    Comment by Kiki — January 21, 2009 @ 2:49 pm

  5. Kiki,
    Yes, it looks like the script is running into a color it can’t convert. There are 2 ways to try and diagnose the problem:
    1) Delete colors one at a time, until you can generate the error with one swatch in your palette, then send me the info on that swatch.
    2) Post the Illustrator file somewhere (you can delete the content and leave the swatches) and I can use the file for testing.

    If I can replicate the error with your help, we should be able to find a fix.

    Comment by Justin — January 21, 2009 @ 5:33 pm

  6. Hey, thanks for offering this awesome script. I also had that apps. error thanks for the fix

    Awesome!!!!

    Comment by Dustin Brunson — February 6, 2009 @ 4:46 pm

  7. Cool extension, thank!

    Comment by dev.My — April 29, 2009 @ 5:39 am

  8. [...] Republished from Ajar Productions. Dec. 5, 2009 [...]

    Pingback by Send Colors from InDesign and Illustrator to Flash (Ajar Productions) « Kelso’s Corner — September 1, 2009 @ 11:02 am

  9. This is extremely useful. Once again I cannot understand why an obvious function like this has to be implemented by someone in his spare time. Thank you very much!

    Comment by Herr Moose — December 2, 2009 @ 4:08 pm

  10. Thanks, Herr Moose! If they made everything perfect, then what would I do with my spare time?

    Comment by Justin — December 2, 2009 @ 5:55 pm

  11. I am getting the same error as adrian wolfson, and the fix you posted works correctly. I am on 64bit Vista, AI and Flash CS4. It might be a good idea to put the fix in the download file, if this script is still maintained.

    Very useful script for such a frustrating gap between Adobe products.

    Comment by Delfeld — April 20, 2010 @ 8:07 pm

  12. Delfield, The files have been updated (new version is 1.1.1). Thanks for your comments.

    Comment by Justin — April 22, 2010 @ 11:26 pm

  13. [...] Click Here to Download Send Swatches to Flash Download Convert to Ns Download Okdo Word Excel PowerPoint to Jpeg Converter 4.2Download PCL To IMAGE GUI+Command Line 6.0Download OX PDF to PSD 2.2.0.24Download OX PDF to TIFF 2.2.0.24 [...]

    Pingback by Download Send Swatches to Flash | Windows Free Softwares — September 11, 2011 @ 6:16 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

You may use the following html tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


two × = 12

Subscribe without commenting