开发者

Calling ActionScript (Flash) method via mshtml from C#

I use the WebBrowser component from WPF. I load there a page from Internet and I access the Document property to call my scripts. Unfortunately calling scripts don't work as I need. When I am calling JavaScript methods which exist in JavaScript so it works great but when I need access some methods which are available through Flash so I have problems.

document.parentWindow.execScript("document.getElementById('swfObject').methodFromActionScript();", "JavaScript");

I get an exception in the browser Object doesn't support this property or method. In C# I get Exception from HRESULT: 0x80020101

But when I try launch this code in a regular browser as IE or Chrome by passing it into URL so the code is executed and I see results.

Maybe some trustmode is开发者_如何学运维sues or what else could deny access to Flash properties and methods?

BTW: The var allowScriptAccess is set to always.

Thank you for help.


Ok, I've found an issue. Before this execScript. I was doing some modification of DOM and moving elements and apparently this has broken DOM so I couldn't call swfObject because during moving it was somehow modified and lost its properties and methods which were exported via ActionScript.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜