JSFL:抑制/自动点击对话框

发布于 2024-10-02 17:00:59 字数 337 浏览 0 评论 0原文

var tmpDoc = fl.createDocument();
/*..some logic...*/
tmpDoc.addItem({x:0,y:0},item);

我的 JSFL 有上面的代码。
在第三行,我看到一个对话框:
标题为:“解决库冲突”
两个单选按钮选项:“替换”、“不替换”
两个按钮:“确定”,“取消”

由于这个对话框,我必须手动监控
脚本执行并单击按钮。

我想要:
1. 完全禁止此类对话框。
2. 或以编程方式为此类对话框提供默认选项。

我该如何使用 JSFL 来做到这一点?

var tmpDoc = fl.createDocument();
/*..some logic...*/
tmpDoc.addItem({x:0,y:0},item);

My JSFL has the above code.
And on the 3rd line, I get a dialog box :
which has title : "Resolve library conflict"
two radio button options : "replace","dont replace"
two buttons : "ok","cancel"

Due to this dialog box, I have to manually monitor
the script execution and click on a button.

I want to either :
1. Suppress these kind of dialog boxex altogether.
2. or programatically provide a default option to these kind of dialogs.

How do I do it with JSFL?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

感性不性感 2024-10-09 17:00:59

我能够解决这个问题。诀窍在于,当您添加新项目时,它会到达库的顶层并在那里查找冲突,即使库文件夹中的某个位置存在“相同”项目。

当您使用 JSFL (library.moveToFolder) 将库项目移动到文件夹中同一项目的位置时,该项目将被替换,并且不会出现冲突对话框。

  1. 如果可能,手动将所需的库项目从库的顶层移动到文件夹中。此操作只需执行一次,并且会对您的库结构造成永久性更改。
  2. 在脚本时,当您将每个项目添加到文档时,调用library.moveToFolder(folderPath, itemPath, true);
  3. 这将覆盖文件夹中的项目并跳过提示

您的具体方法可能会有所不同,具体取决于您的需要,但关键是在添加时不要让项目位于库的顶部。首先将它们移到其他地方。

像往常一样为Flash竭尽全力!希望这有帮助。

PS,这也适用于向库添加组件。

I was able to work around this. The trick is that when you add a new item, it lands at the top level of the library and looks for conflicts there, even if there is an "identical" item somewhere in a library folder.

And when you move a library item using JSFL (library.moveToFolder) to the location of the same item in a folder, the item is replaced, and no conflict dialog appears.

  1. If possible, manually move the library item that you want from the top level of the library into a folder. This is only done once and is a permanent change to your library structure.
  2. At script time, as you add each item to the document, call library.moveToFolder(folderPath, itemPath, true);
  3. This will overwrite the item in the folder and skip the prompt

Your exact approach may be different depending on your needs, but the key is to not have items at the top of the library while you are adding. Move them somewhere else first.

As usual bending over backwards for Flash! Hope this helps.

P.S., this also works for adding components to the library.

胡大本事 2024-10-09 17:00:59

您可以尝试使用库的 检查该项目是否存在,然后再将其添加到库中itemExists() 函数:

var doc = fl.getDocumentDOM();
var lib = doc.library;
//check if the item already exists first, if so, keep count of symbols with the same name, append random, etc.
if(!lib.itemExists('item')) lib.addNewItem('movie clip','item');
else                        lib.addNewItem('movie clip','item'+Math.random());

HTH

You can try to check if the item exists before adding it to the library using library's itemExists() function:

var doc = fl.getDocumentDOM();
var lib = doc.library;
//check if the item already exists first, if so, keep count of symbols with the same name, append random, etc.
if(!lib.itemExists('item')) lib.addNewItem('movie clip','item');
else                        lib.addNewItem('movie clip','item'+Math.random());

HTH

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文