开发者

How can I get values from Flash Authoring in JSFL via XMLUI?

开发者 https://www.devze.com 2023-01-14 20:03 出处:网络
I want to set a variable from a flash file so that I can access if from JSFL in a Command. I am using aelement in JSFL\'s XMLUI:

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 th开发者_如何转开发e 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 ?


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号