简体   繁体   English

将简单变量从AS3发送到Javascript

[英]Sending a simple variable from AS3 to Javascript

I have a flash-based tutorial screen that pops up as an overlay to HTML. 我有一个基于Flash的教程屏幕,该屏幕作为HTML的叠加层弹出。 The overlay is being implemented through standard javascript. 叠加层是通过标准javascript实现的。 My question is how can I simply pass a variable from As3 so that Javascript can use it. 我的问题是如何简单地从As3传递变量,以便Javascript可以使用它。

I basically have 3 screens within the tutorial, and on the final screen I want to pass a variable to the javascript so it can activate an additional set of commands. 在本教程中,我基本上有3个屏幕,在最后一个屏幕上,我想将一个变量传递给javascript,以便它可以激活另外一组命令。 Any assistance would be most appreciated. 任何帮助将不胜感激。

Thanks, 谢谢,

D d

Define a function in JS (say myFunc ). 在JS中定义一个函数(例如myFunc )。 Call it from AS3 & pass the variable (say myVar ) like this: 从AS3调用它并像下面这样传递变量(例如myVar ):

ExternalInterface.call("myFunc", myVar);

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

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