如何通过 XMLUI 从 JSFL 中的 Flash 创作获取值?

发布于 2024-09-16 09:53:42 字数 1440 浏览 2 评论 0原文

我想从 flash 文件设置一个变量,以便我可以在命令中从 JSFL 访问 if 。

我正在 JSFL 的 XMLUI 中使用一个元素: 这是 JSFL:

fl.getDocumentDOM().xmlPanel(fl.configURI + 'Commands/ATest.xml');
fl.trace(fl.xmlui.get('secretword'));//this traces undefined

XMLUI:

<dialog buttons="accept,cancel">
  <textbox id="display_tb" size="24" />
  <flash id="trace_fl" width ="150" height="100" src="ATest.swf">
    <property id="secretword" />
  </flash>
  <button id="trace_btn" label="trace Flash" oncommand="fl.xmlui.set('display_tb','the secret word is ' + fl.xmlui.get('secretword'));" />
</dialog>

ATest.swf 内的操作脚本:

MMExecute("fl.trace('Hello From Flash XMLUI');");
XMLUI.setProperty('secretword','duck');

注意,如果我使用

MMExecute("fl.xml.ui.set('secretword','duck')");

而不是

XMLUI.setProperty('secretword','duck');

我会收到错误。

在 XMLUI 中正确设置了 Secretword:

  • 我可以使用 fl.xmlui.get('secretword') 并在 'display_tb' 文本框中设置值
  • 我可以从 ActionScript 打印该值(使用 fl.trace()),

但我得到了未定义当我打开面板后在 JSFL 中使用 trace fl.xmlui.get('secretword') 时。

从某种程度上来说,这是有道理的,如果 xmlui 变量在 xmlui 对话框显示期间就一直存在,并且一旦用户单击接受取消。 有人可以确认是这样吗?

解决方法是通过 JSFL 从 xmlui 将“secretword”保存在文本文件中,尽管仅将值从 xmlui 节点传递到 JSFL 会更简单。 除了将文件写入磁盘之外,还有“更干净”的方法吗?

I want to set a variable from a flash file so that I can access if from JSFL in a Command.

I am using a element in JSFL's XMLUI:
Here's the JSFL:

fl.getDocumentDOM().xmlPanel(fl.configURI + 'Commands/ATest.xml');
fl.trace(fl.xmlui.get('secretword'));//this traces undefined

The XMLUI:

<dialog buttons="accept,cancel">
  <textbox id="display_tb" size="24" />
  <flash id="trace_fl" width ="150" height="100" src="ATest.swf">
    <property id="secretword" />
  </flash>
  <button id="trace_btn" label="trace Flash" oncommand="fl.xmlui.set('display_tb','the secret word is ' + fl.xmlui.get('secretword'));" />
</dialog>

The actionscript inside ATest.swf:

MMExecute("fl.trace('Hello From Flash XMLUI');");
XMLUI.setProperty('secretword','duck');

Note that if I use

MMExecute("fl.xml.ui.set('secretword','duck')");

instead of

XMLUI.setProperty('secretword','duck');

I get an error.

The secretword is set properly in XMLUI:

  • I can use fl.xmlui.get('secretword') and set the value in the 'display_tb' textbox
  • I can print the value from actionscript (with fl.trace())

but I get undefined when I use trace fl.xmlui.get('secretword') in JSFL after opening the panel.

In a way it kind of makes sense, if the xmlui variables live as long as the xmlui dialog is display, and they become undefined as soon as the user click either accept or cancel.
Can someone confirm is this is the case ?

Aworkaround would be saving the 'secretword' in a text file through JSFL from xmlui, although just passing values from a xmlui node to JSFL would be simpler.
Is there a 'cleaner' way of doing this, other than writing a file to disk ?

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

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

发布评论

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

评论(1

您的好友蓝忘机已上羡 2024-09-23 09:53:43

在某种程度上这是有道理的,如果
xmlui 变量只要存在
显示 xmlui 对话框,并且它们
一旦用户变得未定义
单击接受或取消。能
有人确认是这样吗?

是的,我也这么认为。

解决方法是保存
文本文件中的“secretword”通过
JSFL 来自 xmlui,虽然只是路过
从 xmlui 节点到 JSFL 的值将
更简单一些。有没有一种“更干净”的方法
这样做,除了写一个
文件到磁盘?

为什么不将此密码应用于 XMLUI 的根元素?

In a way it kind of makes sense, if
the xmlui variables live as long as
the xmlui dialog is display, and they
become undefined as soon as the user
click either accept or cancel. Can
someone confirm is this is the case ?

Yes, I think so too.

Aworkaround would be saving the
'secretword' in a text file through
JSFL from xmlui, although just passing
values from a xmlui node to JSFL would
be simpler. Is there a 'cleaner' way
of doing this, other than writing a
file to disk ?

Why not to apply this secretword to root element of your XMLUI?

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