<p>As a follow up to this question: <a href="https://stackoverflow.com/questions/46873/developing-a-online-exam-application-how-do-i-prevent-cheaters">Developing a online exam application, how do I prevent cheaters?</a></p>

<p>Can I detect when Flex application looses its focus? that is if a user has clicked onto another application or opened a browser tab?</p>

<p>I read this: <a href="http://blog.flexmonkeypatches.com/2007/12/07/detecting-when-a-flex-application-loses-focus/" rel="nofollow noreferrer">Detecting when a Flex application loses focus</a> but was not very clear...</p>

The key part of the code at that link is the
```
```
systemManager.stage.addEventListener(Event.DEACTIVATE,deactivate);
```
```
The Flash player send outs activate and deactivate events when the focus enters and leaves the player. All you need to do is create a listenr for them and react appropriately.
A more clear example of how to use to the activate and deactivate events can be seen at
blog.flexaxamples.com
.
Also, it looks like the activate and deactivate events have trouble in some browsers.
Colin Moock has more info on that here.