有没有办法通过 JSFL 脚本请求当前在 Adob​​e Flash/Animate 中打开的 FLA 文件的文件位置?

首先,我根本不是 JavaScript 或 flash 专家。但是我有这个 JSFL 脚本文件,可以通过 Adob​​e flash/Animate 从 fla 文件中提取音频和位图。我想对相当多的 fla 文件执行此操作,但该过程中有一个部分使其比理想情况更耗时,即脚本要求我转到目标文件夹 (browseForFolderURL("Select a folder.")) 的部分.打开的 Windows 资源管理器窗口类型很小,您不能将整个地址粘贴到地址栏中,当您必须浏览许多文件夹时,这很乏味。

当我用文件夹 URL 替换 browseForFolderURL("Select a folder.") 时,它会变得不那么烦人,但我显然每次都必须为每个 fla 文件更改它。理想情况下,我会将脚本的这一部分替换为可以读取/检测我当前在 Adob​​e flash/Animate 中打开的 fla 文件位置的内容,我正在从中提取这些文件。有这样的东西吗?

作为参考,这里是完整的 JSFL 代码。

// 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);
    }
}```
woshiwuchao1 回答:有没有办法通过 JSFL 脚本请求当前在 Adob​​e Flash/Animate 中打开的 FLA 文件的文件位置?

我想你可以使用:

document.path

Read-only; a string that represents the path of the document,in a platform-specific format.

https://www.adobe.io/apis/creativecloud/animate/docs.html#!AdobeDocs/developers-animatesdk-docs/master/Document_object/docum190.md 或者

document.pathURI

Read-only; a string that represents the path of the document,expressed as a file:/// URI.

https://www.adobe.io/apis/creativecloud/animate/docs.html#!AdobeDocs/developers-animatesdk-docs/master/Document_object/docum200.md

本文链接:https://www.f2er.com/1168400.html

大家都在问