Hi all.
I need to display Flash animation in my Qt application, and ability to control it programmaticaly. The only decision I found is - use QWebKit and control Flash through Java. I have sample html file that is parialy works on IE, Opera and Google Chroome(which is built on top of WebKit as I know). But when I'm loading this webpage in my Qt application - I see working flash animation. But non of scripts are working well.
Here is script example:
function getFlashMovieObject(movieName)
{
return document.getElementById(movieName);
}
function PlayFlashMovie()
{
var flashMovie=getFlashMovieObject("myFlashMovie");
if (flashMovie == null) alert("bad");
else alert("good");
//everything is ok until here
flashMovie.Play();
//never see this message
alert("I'm here");
}
function getFlashMovieObject(movieName)
{
return document.getElementById(movieName);
}
function PlayFlashMovie()
{
var flashMovie=getFlashMovieObject("myFlashMovie");
if (flashMovie == null) alert("bad");
else alert("good");
//everything is ok until here
flashMovie.Play();
//never see this message
alert("I'm here");
}
To copy to clipboard, switch view to plain text mode
The same situation with another scripts. In places where I try to access Flash object - java script is silently terminates.
I posted this thread on this forum - because in browsers something seems to work (at least Platy/Pause ZoomIn/ZoomOut), but from Qt application nothing is working.
Here is code from app:
SlideViewWidget
::SlideViewWidget(QWidget * parent
) : QWebView
(parent
){
page()->settings()->setAttribute(QWebSettings::JavascriptEnabled,true);
page()->settings()->setAttribute(QWebSettings::PluginsEnabled,true);
page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows,true);
loadFilm
(QString("file://localhost/") + Resources
::resourcePrefix + "test.swf");
}
SlideViewWidget::~SlideViewWidget()
{
}
void SlideViewWidget
::loadFilm(const QString & fname
) {
QString html
= Resources
::flashPlayerBaseHtml;
setHtml(html);
}
SlideViewWidget::SlideViewWidget(QWidget * parent) : QWebView(parent)
{
page()->settings()->setAttribute(QWebSettings::JavascriptEnabled,true);
page()->settings()->setAttribute(QWebSettings::PluginsEnabled,true);
page()->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows,true);
loadFilm(QString("file://localhost/") + Resources::resourcePrefix + "test.swf");
}
SlideViewWidget::~SlideViewWidget()
{
}
void SlideViewWidget::loadFilm(const QString & fname)
{
QString html = Resources::flashPlayerBaseHtml;
setHtml(html);
}
To copy to clipboard, switch view to plain text mode
Realy need help. Thanks.
Bookmarks