JSFL:抑制/自动点击对话框
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我能够解决这个问题。诀窍在于,当您添加新项目时,它会到达库的顶层并在那里查找冲突,即使库文件夹中的某个位置存在“相同”项目。
当您使用 JSFL (library.moveToFolder) 将库项目移动到文件夹中同一项目的位置时,该项目将被替换,并且不会出现冲突对话框。
您的具体方法可能会有所不同,具体取决于您的需要,但关键是在添加时不要让项目位于库的顶部。首先将它们移到其他地方。
像往常一样为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.
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.
您可以尝试使用库的 检查该项目是否存在,然后再将其添加到库中itemExists() 函数:
HTH
You can try to check if the item exists before adding it to the library using library's itemExists() function:
HTH