无法从Flash AS2调用JavaScript [英] Unable to invoke javascript from flash AS2
问题描述
<
所以我见过许多人建议使用
使用getURL( JavaScript的:myFunction的(););
或
import flash.external.ExternalInterface;
ExternalInterface.call(myFunction());
用于调用我的html文件(头部)中的方法myFunction。但是,由于某种原因,该方法未被调用。除此之外,我在我的框架代码,只是停止闪存电影结束(我试着在这之前和之后的js调用)
停止();
我也在我的html下有< object> code $:
< param name =allowScriptAccessvalue =always/>
并且在嵌套的<! - [if!IE] > - >
。
(如果需要,我也可以添加html文件)我究竟做错了什么?删除停止();好像没有改变任何东西(除了正在播放的电影)。
好的,这个问题是一个相当愚蠢的但是我已经决定把它写下来,以防将来有人会偶然发现同样奇怪的行为
发生了什么事情,我在同一天安装了Flash CS6,并没有重新启动我的机器。重新启动后,调用 getURL(javascript:myFunction(););
只是简单的工作 - 只记得< param名字=allowScriptAccessvalue =always/>
在您的html上。
First of all, I'm a complete noob in Flash and don't really know what I'm doing :/ (it's a favour for a friend).
I'm working with CS6 and using action script 2.
So I've seen many people suggesting using
getURL("javascript:myFunction();");
or
import flash.external.ExternalInterface;
ExternalInterface.call("myFunction()");
for calling the method myFunction that I have in my html file (in the head). However, for some reason the method is not invoked. Apart of that I have in my frame code that just stops a flash film that ends (I tried putting this before and after the js invocation)
stop();
I do also have on my html under the <object>
:
<param name="allowScriptAccess" value="always" />
and again in the nested <!--[if !IE]>-->
.
(If needs be, I can add the html file as well.) Can anyone shed a light on what am I doing wrong? Removing the stop(); doesn't seem to change anything either (apart of the film being replayed.
Ok, so the issue is a rather silly thing, but I've decided to put it down in writing in case someone in the future will stumble upon the same weird behaviour.
What happened was I have installed Flash CS6 on the same day and didn't reboot my machine. After rebooting it, calling getURL("javascript:myFunction();");
simply worked- just remember to also have the <param name="allowScriptAccess" value="always" />
on your html.
这篇关于无法从Flash AS2调用JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!