简体   繁体   English

将JavaScript变量传递给Flash

[英]Passing JavaScript variables to Flash

I'm specifically looking at how this tool works: 我正在专门研究此工具的工作方式:

https://datatables.net/extensions/tabletools/ https://datatables.net/extensions/tabletools/

How does the JavaScript variable get to Flash? JavaScript变量如何到达Flash?

It looks like there is an embed that is retrieved with getElementById , and that element has all of these extra methods on it like appendText or setCharSet that do not show up in Chromes debug console. 看起来好像有一个用getElementById检索的embed ,并且该元素上具有所有这些额外的方法,例如appendTextsetCharSet ,这些方法不会显示在Chrome调试控制台中。 I figure the embed tag is maybe special and can somehow call native ActionScript methods, but that is just a guess. 我认为embed标签可能很特殊,并且可以以某种方式调用本机ActionScript方法,但这只是一个猜测。

Could someone please explain to me how this works? 有人可以告诉我这是如何工作的吗?

EDIT: I should have said that if I create an embed element in Chrome and scroll through its methods, I do not see things like appendText . 编辑:我应该说,如果我在Chrome中创建一个embed元素并滚动浏览其方法,则不会看到诸如appendText东西。 However, if I console log the embed that was retrieved via getElementById and console.log appendText , it says function() { [native code] } . 但是,如果我控制台记录通过getElementByIdconsole.log appendText检索到的embed ,它将显示function() { [native code] }

Using this maybe? 使用这个也许? i never tried this but besides this option not sure how you could do it 我从来没有尝试过,但是除了这个选项,我不确定你怎么做
http://www.permadi.com/tutorial/flashjscommand/ http://www.permadi.com/tutorial/flashjscommand/

You use ExternalInterface to communicate between the swf and the swf container, ie the html page. 您可以使用ExternalInterface在swf和swf容器(即html页面)之间进行通信。

You do it exactly like this: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html 您完全按照以下步骤操作: http : //help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM