我将FBML用于FB应用程序
我有一个flash,flash会在页面上调用一个javascript。我浏览了很多网站,试图弄清楚这个问题,但仍然存在问题。
下面是包含javascript的网页:
<fb:fbjs_bridge/>
<div id="swfContainer"></div>
<script>
// the javascript to call and change the text of ztest001
function callmenow(a) {
var obj = document.getElementById("ztest001");
obj.setTextValue("Calling");
}
// generating the SWF
var swf = document.createElement('fb:swf');
swf.setId('my_swf_id');
swf.setWidth('630');
swf.setHeight('520');
swf.setSWFSrc('http://hollywood-life.madscience-games.com/ztest/test1.swf');
document.getElementById('swfContainer').appendChild(swf);
</script>
<div onclick="callmenow('a')">call me now</div>
<div id="ztest001"> YOo </div>这是Flash代码。(一帧。代码在框架上。带有文本框"myvar1")
var connection:LocalConnection = new LocalConnection();
var connectionName:String = LoaderInfo(this.root.loaderInfo).parameters.fb_local_connection;
connection.allowDomain("apps.facebook.com", "apps.*.facebook.com");
function callFBJS():void{
myvar1.text = "START"; // debugging purpose
if (connectionName) {
myvar1.text = "Connection now"; // debugging purpose
var pArray = ['bs'];
connection.send(connectionName, "callmenow", "callmenow", pArray);
myvar1.text = "SENT";
}
}
callFBJS();当我测试的时候,闪存加载了。代码将遍历所有内容,并在flash文本框中显示“已发送”。但是,它看起来并不像是在调用javascript并更改HTML页面中的文本。
我做错什么了吗?我尝试了ExternalInteface.call方法,但这也不起作用。
此外,当我在FireFox中运行它时,不会弹出错误。然而,当我在IE中运行它时,我得到了这样的结果:
VerifyError: Error #1033: Cpool entry 36 is wrong type.
ReferenceError: Error #1065: Variable FBJS is not defined.发布于 2010-02-11 05:19:07
你有没有试着改变:
connection.send(connectionName, "callmenow", "callmenow", pArray);至
connection.send(connectionName, "callFBJS", "callmenow", pArray);https://stackoverflow.com/questions/2231834
复制相似问题