# NativeWindow focus after activate()

**URL:** <https://forum.kirupa.com/t/nativewindow-focus-after-activate/299468>\
**Category:** flash\
**Created:** [November 5, 2009, 12:42pm UTC](https://forum.kirupa.com/t/nativewindow-focus-after-activate/299468 "2009-11-05T12:42:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swooter](https://avatars.discourse-cdn.com/v4/letter/s/e9a140/32.png) [@Swooter](https://forum.kirupa.com/u/Swooter)\
**Post date:** [November 5, 2009, 12:42pm UTC](https://forum.kirupa.com/t/nativewindow-focus-after-activate/299468/1 "2009-11-05T12:42:46Z")

</div>

Hi guys, I was wondering…

I’ve got a NativeWindow that I open from a systemtray/dock icon (it’s a custom styled menu)

The window needs to close when the user clicks outside the window, so I used Event.DEACTIVATE to hide the menu window.

This only works when I’ve clicked inside the window once, but it doesn’t work when the window hasn’t got focus yet…

How can I open (activate) a NativeWindow and set the focus to the window so clicking outside will trigger Event.DEACTIVATE?
