开发者

What is the "hasOwnProperty()" equivalent for interface?

What is the "hasOwnProperty()" equivalent for interface?

I have found this related bug at Adobe: https://bugs.adobe.com/jira/browse/FB-27683

Any workaround except try..开发者_JS百科catch statement?


Have you considered this?

if("foo" in bar){ ...

where "foo" is the name of a property and bar is the object reference as Interface?

Here it is in action in a real world scenario:

import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;

var i:IEventDispatcher = new EventDispatcher();
if("dispatchEvent" in i){
    trace(" I have dispatchEvent");
}


The other answer is better, but you can also use

i['hasOwnProperty']('dispatchEvent')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜