tags:

views:

239

answers:

2

I have a Flash player (flash9.ocx) embedded in an ATL window and have coded functionality into the swf to respond to the return/enter key being pressed. Works fine from the standalone swf player but as soon as its played from within my embedded player it doesn't execute. It's as if my window is getting in the way somehow? Is there any way to pass the keypress through to the player?

FYI, there isn't anything to weird in place on the form.

Thanks!

A: 

I'm not VC++ developer, but I use Flash a lot.

Though not sure, it seems that the embedded player doesn't have the focus. Make sure you've got this part covered on the Flash side of things:

  • the stage exists ( you movie is properly initialized)
  • you set the KeyboardEvent listener to the stage.

You could use the FocusManager to make sure you've got the focus.

I don't know if you can pass the focus from you app to the SWF OLE through some tabIndex or something.

If still this doesn't work you can try using the External Interface to add callbacks from your app to flash player ( basically call and actionscript function from your app ).

This was achieved through fscommand before, but External Interface seems to be the thing to use now.

Good luck!

George Profenza
A: 

Hi Adam. I don't use flash a lot but i'm a C++ programmer. =) Let's see if I can help you. I believe that your application is catching all the events before your flash movie. I don't know if there is a better way to do this but you could listen for any keyboard event on your form and use the SetVariable of your ActiveX component to set a variable inside Flash. Then, in the Flash Movie you could set a watch for any changes on this variable and trigger your Enter event.

Hope this helps.

Theo