外部接口回调不听吗? [英] External Interface callback not listening?

查看:94
本文介绍了外部接口回调不听吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让JavaScript来谈谈闪光灯,但我一直没能得到它的工作。我已经得到了周围闪交谈JavaScript的,而不是其他的方式。这似乎为思想闪光灯不听的JavaScript,或者说我做得不对。有什么建议?

在AS3的一部分,最初叫JS:

  ExternalInterface.call(showGal,slastSelectedNumber);
 

JS的我想要用的是:

 函数showGal(dPicture){
。的document.getElementById('fullsizegallery')的style.display =块;
的document.getElementById(flashGalleryContent)someFunctionName(dPicture)。
}
 

其他Flash文件我想谈的AS3的部分:

  VAR连接= ExternalInterface.addCallback(someFunctionName,changePicNumber);

功能changePicNumber(newNumber:编号):无效{
picNumber = newNumber;
如果(jsonLoaded ==真){
loadImageBig(picNumber);
}
}
 

解决方案

请确保您有类似:< PARAM NAME =allowScriptAccess的值=总是/> 在Flash嵌入HTML

I'm trying to get javascript to talk to flash, but I haven't been able to get it to work. I've gotten flash to talk to javascript, but not the other way around. It seems as thought flash isn't listening to the javascript, or I'm doing something wrong. Any suggestions?

Part of the AS3 to initially call the js:

ExternalInterface.call("showGal", slastSelectedNumber);

The js i'm trying to use is:

function showGal(dPicture) {
document.getElementById('fullsizegallery').style.display = 'block';
document.getElementById("flashGalleryContent").someFunctionName(dPicture);
}

Part of the AS3 of other flash file I'm trying to talk to:

var connection = ExternalInterface.addCallback("someFunctionName", changePicNumber);

function changePicNumber(newNumber:Number):void {
picNumber = newNumber;
if (jsonLoaded == true) {
loadImageBig(picNumber);
}
}

解决方案

Make sure you have something like: <param name="allowScriptAccess" value="always" /> in the Flash html embedding.

这篇关于外部接口回调不听吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆