How to list available callbacks exposed by a flash element

微笑、不失礼 提交于 2019-12-10 16:19:48

问题


Is there a way to query an embedded flash element to determine the available methods that can be executed on it via JavaScript?

Edit: It appears that in IE it's as simple as

for ( i in flashNode ) {
    alert(i);
}

After much clicking, they will be some of the very last members enumerated.

Still not able to determine this in Firefox though.


回答1:


While it is possible to get the callbacks by enumerating the <object> DOM node in IE, they are mixed in with all the other properties of the DOM node and they are unable to be progamatically distinguished without keeping a list of known properties to compare them against and then taking the difference of the two sets.

This approach is questionable since properties can be arbitrarily added to any DOM node. Worse, it only works in IE. Firefox (and possibly others) does not return callbacks as a property of the <object> DOM node.




回答2:


I believe it works the same way in FF and other browsers, but you may need to get the reference to your swf element differently than IE.

IE will use an object tag, generally with an id, and ff/safari/etc will use the embed tag, and since you aren't supposed to be the same id on two elements, people generally use the name attribute instead of an id attribute on the embed tag.

If you are using something like SWFObject to embed your swfs, then you should only get one or the other (object or embed) and whichever one gets written will have the id attribute set with whatever you specify, so then you could iterate over the object.



来源:https://stackoverflow.com/questions/1047810/how-to-list-available-callbacks-exposed-by-a-flash-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!