Adobe AnimateJSFLDesign ToolsAutomation

Adobe Animate JSFL: Rename Library Items in Bulk

Use a JSFL script in Adobe Animate to batch rename library MovieClip and Bitmap items by replacing unsafe or inconsistent prefixes before exporting CreateJS assets.

·Updated ·9 min read·Counting...
Adobe Animate JSFL: Rename Library Items in Bulk

Adobe Animate projects often collect many library items from Photoshop, pasted images, and manually named symbols. If those names include Chinese characters, spaces, or inconsistent prefixes, exported JavaScript or CreateJS workflows can become harder to maintain and may hit encoding or reference issues in some deployment environments.

When there are dozens or hundreds of items, manual renaming is not a good use of time. A JSFL script can rename matching library items in bulk.

What this script does

The script:

  • gets the current Adobe Animate document
  • reads all library items
  • checks item types such as MovieClip and Bitmap
  • replaces selected name prefixes
  • writes progress to the Animate output panel

It does not rename every item. It only touches names that match the prefixes you define.

Create a JSFL file

Create a plain text file named something like:

rename-library-items.jsfl

The extension must be .jsfl. Keep the filename in English to avoid path and encoding surprises.

Script example

var doc = fl.getDocumentDOM()
var libraryItems = doc.library.items

var prefixMap = {
  "位图 ": "flywt_",
  "对_": "r_",
}

for (var i = 0; i < libraryItems.length; i++) {
  var item = libraryItems[i]

  if (item.itemType === "MovieClip" || item.itemType === "Bitmap") {
    for (var oldPrefix in prefixMap) {
      if (item.name.indexOf(oldPrefix) === 0) {
        var newName = prefixMap[oldPrefix] + item.name.substring(oldPrefix.length)
        item.name = newName
        fl.trace("Renamed: " + item.name)
        break
      }
    }
  }
}

fl.trace("Finished renaming matching library items.")

Customize prefixMap for your own naming rules:

var prefixMap = {
  "位图 ": "bitmap_",
  "按钮_": "btn_",
  "对_": "r_",
}

How the code works

Get the current document:

var doc = fl.getDocumentDOM()

Read library items:

var libraryItems = doc.library.items

Define old-to-new prefix rules:

var prefixMap = {
  "位图 ": "flywt_",
  "对_": "r_",
}

Loop through the library, check item types, and rename matching items:

if (item.itemType === "MovieClip" || item.itemType === "Bitmap") {
  // rename matching prefixes
}

fl.trace() prints messages in the output panel so you can see what changed.

Run the command

  1. Open the Adobe Animate document.
  2. Use the Animate menu command for running a JSFL command.
  3. Select the .jsfl file.
  4. Check the output panel for the completion message.
  5. Review the library before saving over important work.

Always test on a copy of the document first. Bulk rename scripts are convenient, but they can break timeline or code references if your project expects exact names.

Possible extensions

You can extend the script to:

  • support more prefixes
  • include Button or other item types
  • skip already-correct names
  • detect name conflicts before renaming
  • write a more detailed log

For production projects, conflict detection is worth adding before a broad rename.

Subscribe to FreeMac

Weekly picks: free Mac software reviews, trusted source updates, alternatives, and low-friction guides.