Extract sounds and images from FLA in Flash CC with JSFL

Recently I learned that Flash CC dropped the ability to export WAV files! Dumb move by Adobe in my opinion, but what’s done is done.

After some Googling, I discovered this post on stackoverflow that contains a JSFL script to enable extracting sounds or images from the library of an FLA. It’s a few years old at this point, but I can confirm it still works for sounds as of Flash Pro CC 2014. If anyone has a more modern solution I’m all ears, but I’ll repost the code here in case that link ever breaks:

// Result of attempts to export will go to the output panel,
// so clear that first fl.outputPanel.clear();

// If bitmaps/audio in the library have been selected, export only
// those. Otherwise, export all bitmaps/audio in the library.

var lib;
if (fl.getDocumentDOM().library.getSelectedItems().length > 0) {
    lib = fl.getDocumentDOM().library.getSelectedItems(); 
} else { lib = fl.getDocumentDOM().library.items; } 

// Get destination directory for files 
var imageFileURLBase = fl.browseForFolderURL("Select a folder."); 
var imageFileURL; 

var totalItems = lib.length;
// Iterate through items and save bitmaps and 
// audio files to the selected directory.
for (var i = 0; i < totalItems; i++) 
{
    var libItem = lib[i];
    if (libItem.itemType == "bitmap" || libItem.itemType == "sound") 
    {
        // Check the audio files original Compression Type if "RAW" export only as a .wav file
        // Any other compression type then export as the libItem's name defines.
        if(libItem.itemType == "sound" && libItem.originalCompressionType == "RAW")
        {
            wavName = libItem.name.split('.')[0]+'.wav';
            imageFileURL = imageFileURLBase + "/" + wavName;
        } else {
            imageFileURL = imageFileURLBase + "/" + libItem.name;
        }
        var success = libItem.exportToFile(imageFileURL);
        fl.trace(imageFileURL + ": " + success);
    }
}

You'll need to save this to a file with a .jsfl extension, select any number of sounds or images from the library, and then go to Commands > Run Command in Flash Pro and navigate to the file. It'll ask you for an output directory and save the selected items there. If you don't select items in the library beforehand, it'll export all sounds and images found in the library.

To get the command to show up in the commands menu, put the file here:

Windows 7: boot drive\Users\username\AppData\Local\Adobe\Flash CC\language\Configuration\Commands

Windows Vista: boot drive\Users\username\Local Settings\Application Data\Adobe\Flash CC\language\Configuration\Commands

Mac OS X: Macintosh HD/Users/userName/Library/Application Support/Adobe/Flash CC/language/Configuration/Commands

filesystem data from here

11 thoughts on “Extract sounds and images from FLA in Flash CC with JSFL

    1. I’m confused as to why you’re talking about an illustrator file. Could you please explain in more depth? The command should export images (bitmaps) and sounds only. It won’t work on vector objects.

  1. Just wanted to say huge thanks for the script!!! Had fla file with wav’s, that i couldn’t extract to Audition, but this jsfl saved my ass! 🙂 Thanks a lot!

  2. Can confirm this still works in Animate CC 2018, though I found one limitation that users should be aware of. (Though obvious)

    If the file in the library doesn’t have a file extension as part of its name, it seems to fail to export.
    Adding “.jpg” or whatever relevant extension allows it to export.

    Thanks for spreading this script/making it easily available!

    1. I had this issue trying to extract bitmaps generated within Flash and it was not feasible to manually edit all the names. I simply added +”.png” to the imageFileURL line, and that worked!

      Still works in 2019 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *