有没有办法让暴露的功能列表从Flash对象?例如,你可以得到的对象中的所有方法的列表执行:
Is there a way to get a list of the exposed functions from a Flash object? For example, you could get a list of all methods in an object by executing:
for (var i in object) {
if (typeof object[i] == "function") {
console.log(i);
}
}
唯一的问题是,这会不会暴露通过ExternalInterfaces API注册的方法。我可以试一下,看看是否存在功能(对象['法']
),它告诉我,这是一个函数,但我将不得不猜测在这每一个现有的方法方式。
The only issue is that this won't expose any methods registered through the ExternalInterfaces API. I can try and see if the function exists (object['method']
) and it tells me it is a function, but I would have to guess every existing method in this manner.
注:很显然,我没有访问动作
NOTE: Obviously, I don't have access to the actionscript.
推荐答案
只要按下这个问题,稍微来晚了,似乎,但我会后回答反正;) 使用IE10(Windows 7)中,它的工作完全正常,我列出我所有的方法,像这样:
Just hit this question, a tad to late it seems, but I'll post an answer anyways ;) Using IE10 (windows 7) it worked perfectly fine for me to list all my methods like so:
var obj = document.getElementById('flashObj');
for(var prop in obj){
var fx = obj[prop];
if(obj.hasOwnProperty(prop) && (typeof fx == 'function') && /eval(instance/.test(fx)){
console.log(prop)
}
}
请注意,这并不在Chrome或Firefox,只与自IE10精确表达式不报原生code为其他浏览器做的工作。
Note that this did not work in Chrome or Firefox and only with the exact regexp since IE10 does not report "native code" as the other browsers do.
相关推荐
最新文章