Can't call Flash (Swf) method from Javascript within QWebView
I have:
- Swf-file, that a) makes one of its method available to the outer world through ExternalInterface.addCallback; b) calls predefined outer world method through ExternalInterface.call;
- html-page, where this Swf-file resides. There are two javascipt methods in this html: one for calling Swf-published-method and one for being called by swf;
- Qt-app, that loads this html-page through QWebView->QWebPage.
When I load this html-page in FireFox everything works ok: Swf can be called from javascript and vice-versa. However within Qt-app only swf can call javascript method, but not vice开发者_JS百科-versa. Calling swf method fails with the following message printed on javascript console: "Error calling method on NPObject".
Any ideas how to make Qt-app behave like FireFox, i.e. to make it possible to call Swf from javascript? Any help will be appreciated,
Backgrounds:
- Qt 4.6.2;
- Kubuntu 10.04;
- Swf was built with Flex 4;
- Swf is local trusted.
Fixed problem by myself.
The original code for loading html-page was like this:
QFile html(<theHtmlPageFileName>);
html.open(QIODevice::ReadOnly);
m_page->mainFrame()->setContent(html.readAll());
The rewritten variant:
m_page->mainFrame()->load(<theHtmlPageFileName>);
In latter variant everything works fine.
Btw: Under Windows first variant works too.
精彩评论