PDA

View Full Version : QAxWidget fails to call a function registered by Swf ExternalInterface



rsilva
20th September 2011, 22:04
Hi, as I've said in the title, I'm using QAxWidget to load my flash file and communicate between then by the ExternalInterface.
Sorry if it isn't the right place to ask. Don't know if this is an "Active x" question, but...

My problem is:
When I use QAxWidget::dynamicCall("playSong(const QString&)", "url");

Nothing happens and I have this output:
QAxBase::dynamicCallHelper: playSong(QString): No such property in {d27cdb6e-ae6d-11cf-96b8-444553540000} [Shockwave Flash Object]

But when using QWebView and calling the same function with evaluateJavascript it works.
(i. e. document['myFlashFile'].playSong("url");)

In my swf file I'm using ExternalInterface.addCallback("playSong", this.playSong);

I've did some searchs but find nothing about it, what I've found was some problems using other objects.
Sorry again, if this is a wrong place and thanks for reading (and for helping).

poth
21st September 2011, 15:32
With QAxBase::generateDocumentation(), you can get a list of properties of a Shockwave Flash Object.

Here is a list of properties:

http://webcache.googleusercontent.com/search?q=cache:thDLVRA2uL4J:semdream.zapto.org/QT_workspace/DDT_CLIENT/flash_activex_api.html+%22LoadMovie%28int+layer,+Q String+url%29%22+FLASH&cd=1&hl=es&ct=clnk&gl=es&client=firefox-a

There is no "playSong(QString)" slot. I think you must use "LoadMovie(int layer, QString url)" and "Play()"

rsilva
21st September 2011, 18:17
Yes, i know the object have it's "default" properties, but with flash.external.ExternalInterface package, you can "expose" functions of your flash app.
Calling "Play()", "LoadMovie()", "SetVariable()", works, but not my function "exposed" by ExternalInterface.addCallback.

But, thanks for the reply, in the link I've found this: "QString CallFunction(QString request);"
Maybe it works but, I don't know how to use it, I'm searching right now lol, maybe something like this dynamicCall("CallFunction(QString)", "playSong(\"url\")")

And maybe I use this too: void DisableLocalSecurity(). The client with QWebKit needs to have swf path (qrc:/swf/bridge.swf) as trusted.
It would be nice to don't need to set it in the settings.

Thank you again :D