Skip to main content
December 3, 2010
Answered

Can I get "on blur" and "on focus" events for my window

  • December 3, 2010
  • 2 replies
  • 1180 views

Is it possible to get en event when the window running my flash gets focus and loses focus?

I would like to be able to start and stop the video automatically.

Thanks

This topic has been closed for replies.
Correct answer Andrei1-bKoviI

Try to listen to Event.ACTIVATE and Event.DEACTIVATE. It works in the majority of cases.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispatcher.html#event:activate

2 replies

Andrei1-bKoviICorrect answer
Inspiring
December 3, 2010

Try to listen to Event.ACTIVATE and Event.DEACTIVATE. It works in the majority of cases.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/EventDispatcher.html#event:activate

December 6, 2010

Thank You.  That is excellent.

I noticed that the events get fired and acted upon in the test environment and if I publish to an exe - but not if I publish to html.

No problem - I'll just use the exe.

Inspiring
December 6, 2010

You are welcome.

Actually it is supposed to work in html as well. I tested it. The only issue is that it doesn't work all the time. I cannot tell what use cases make this fail in html.

kglad
Community Expert
Community Expert
December 3, 2010

you can use javascript to detect those events and you can use the externalinterface class in flash to communicate with javascript.  in particular, check the callback() method.