views:

15

answers:

1

Hi,

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 issues or what else could deny access to Flash properties and methods?

BTW: The var allowScriptAccess is set to always.

Thank you for help.

A: 

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.

Tomáš Linhart