Flash Extension: Export as Motion Preset Preview

This is the first extension that I’ve written exclusively for the new Flash CS4 features. Flash CS4 not only allows you to create extremely complex animations with a high level of control, but it also allows you to save those animations for reuse in the new Motion Preset panel.

I got the idea for this extension from Lee Brimelow’s excellent tutorial on the Motion Preset panel. Since I imagine that I’ll be creating a lot of my own motion presets, and I’d like them to have live previews just like the default presets, I decided to automate the process.

Here’s how it works:
Once you’ve created a custom motion preset, you can use this command to immediately create a live preview from your current document. This assumes that the motion preset is the only thing in your document. If that’s not the case, you may want to open a new document, paste the animation, and run the command from there.

Feedback welcome.

UPDATE:

  • Version 1.1.0 now supports multiple languages. Thanks to jeanphilippe for the catch!
  • Know issue: Preview is not retained if the preset is moved to a different folder within the Motion Preset panel. This is because Flash does not keep track of the preview files, it just knows to look for them.

Download
(compatibility: Flash CS4 and later, including CC and CC 2014)
Export as Motion Preset Preview.zip

Get updates from Ajar Productions

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

Unsubscribe at any time. Powered by Kit

21 replies on “Flash Extension: Export as Motion Preset Preview”

  1. jeanphilippe says:

    Hi,
    have you tested on Mac ?
    ’cause i’ve an error in line 31
    thanks
    JP

  2. jeanphilippe says:

    oups !
    it’s normal under a Flash CS4 french language version
    the good code for french users is :

    //Export as Motion Preset Preview
    //Justin Putney
    //http://putney.ajarproductions.com
    //version 1.0.0

    var dom = fl.getDocumentDOM();
    var sel = fl.presetPanel.getSelectedItems();

    if(sel.length == 1) run();
    else if(sel.length > 1) alert (”You have more than 1 preset selected.”);
    else if (sel.length < 1) alert (”You must select a motion preset first.”);

    function run(){
    var sItem = sel[0];
    //check to make sure it’s not a folder
    if(sItem.isFolder){
    alert(”Please select a preset and not a folder.”);
    return;
    }
    //check to make sure it’s not a default
    if(sItem.isDefault){
    alert(”This cannot be applied to a default preset.”);
    return;
    }
    fl.trace(sItem.path);
    var pathArr = sItem.path.split(”/”);
    if(pathArr[0] == “Présélections personnalisées”) pathArr.shift();
    pathArr.unshift(”Motion Presets”);
    var fileName = pathArr.join(”/”) + “.swf”;
    var swfFile = fl.configURI + fileName;
    //export swf
    dom.exportSWF(swfFile, true);
    //refresh panel
    fl.presetPanel.selectItem(sItem.path, true, false);
    fl.presetPanel.selectItem(sItem.path, true);
    }

  3. Justin says:

    Thanks for the catch and fix, jeanphilippe! The language variations in folder names was not something I had anticipated. I’ll check to see if there’s a way to get that information automatically and/or make it language non-specific.

  4. jeanphilippe says:

    Thanks Justin 🙂

  5. Justin says:

    Okay, I think I’ve got it fixed. Try version 1.1.0.

  6. jeanphilippe says:

    Oh my god ! it’s universal now !
    no way… your new version is great now
    thanks a lot for us !

  7. Kribba says:

    Great stuff, thanx!

  8. Abel says:

    It’s amazing, Thanks

  9. dr.nour says:

    thanx alot.. !!
    it’s amazing & helps alot …

    thank u justin

  10. another justin says:

    Thank you Justin, this is so much easier than copying the swf over. Very much appreciated!

  11. tarek says:

    sorry guys, but it seems like i dont understand how this works
    now i downloaded that “gray” file
    but i dont know what to do next
    so if anyone has patience to give me detailed instructions to what to do, i would be grateful

  12. Justin says:

    Tarek,

    Not sure what you mean by the “gray” file. Could you clarify?

  13. Thank you very much…

  14. Jesus says:

    WOW!
    very nice job!

    1. Justin says:

      Thanks, Jesus!

Comments are closed. Still have questions?

Contact Ajar