I want to add an event to the current window in a browser based program.
I want to find out when the window is no longer selected. I believe I would want to listen for Event.deactivate, correct?
Problem though, I don't know how to get an instance to that current window.
-Can't add an event listener to that, and I don't even know if that's the window.
I've also tried:
var window = this.stage.nativeWindow;
-When I build I get this error though: Access of possibly undefined property nativeWindow through a reference with static type flash.display:Stage.
So what do I need to do to get this window? Then, what's the correct event I want to listen for?
Depends on what you mean by “window”. A browser-based Flash app defaults to a single browser window with a single FlashPlayer instance whose drawable area is the “stage”. Clicking outside that area, even on the address bar of the browser window results in an Event.DEACTIVATE.
If you are using Flex TitleWindows or Panels to create the look of a multi-window app within this stage, there should be WINDOW_DEACTIVATE events and the ActiveWindowManager is keeping track, but you might want to manage the windows on your own anyway.
Europe, Middle East and Africa