如何公开一个嵌入式Flash对象的JavaScript的接口? [英] How to expose the JavaScript interface for an embedded Flash object?

查看:186
本文介绍了如何公开一个嵌入式Flash对象的JavaScript的接口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JavaScript和Flash Player可以通过Flash的ExternalInterface的机制进行数据交换:你注册ActionScript函数,你想成为能够从JavaScript叫

JavaScript and the Flash Player can exchange data via Flash's ExternalInterface mechanism: you register ActionScript functions that you would like to be able to be called from JavaScript.

我的问题:我怎样才能弄清楚什么是Flash对象的ActionScript函数可我从JavaScript调用(假设他们没有记录)

My question: How can I figure out what ActionScript functions of a Flash object are available for me to call from JavaScript (assuming they are not documented)?

有没有一种程序化的方式来做到这一点在JavaScript?

Is there a programatic way to do this in JavaScript?

谢谢!

推荐答案

您不能直接列举它们(他们将不会被列在for..in循环),但你可以测试明确每一个..

you can't enumerate them directly (they won't be listed in a for..in loop), but you can test for each one explicitly...

var swf = document.getElementById('theID');
alert('someMethod' in swf);  // will alert true if 'someMethod' is exposed via ExternalInterface.addCallback

如果在$(文件)称这种可能会失败。就绪或在window.onload - 的swiff必须初始化(加载和注册),公开的方法可用在所有

this might fail if called during $(document).ready or window.onload - the swiff must be 'initialized' (loaded and registered) for the exposed methods to be available at all.

这篇关于如何公开一个嵌入式Flash对象的JavaScript的接口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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