1

I have a Adobe Air app (AS3, not Flex) that has 2 windows. When I click away from them onto another desktop program, I get an "Deactivate" Event (as you would expect).

When I click on say Window#1 I get an "Activate" Event (as you would expect).

But when I go from Window#1 to Window#2, I get nothing. And I believe this is because the Air application is still the active program, Just a Different Window.

But I have the need to know when I go from 1 window to another.

The horrible solutions I have come up with so far is to have an onEnterFrame and check if the current window is the active window. But I would much prefer to do it a much better way that such a hack.

I have gone though Stage, NativeApplication and Native Window Events and none of them do what I need. Can anyone point me to another Event I may have overlooked?

WORMSS
  • 1,625
  • 28
  • 36
  • I dunno, it seems like listening for activate should work. Are you sure your listening for it fromt he correct dispatcher? If you switch to another application and then back to Window 2, does Window 1 fire the activate event? – Jason Dean Oct 06 '11 at 18:08
  • Yes, if you go from Window#1 to other App then Window#1 (or Window#2) It fires an activate. But if you go from Window#1 to Window#2 or Window#2 to Window#1 (Eg, you never actually leave the Air Application) No Event is triggered. – WORMSS Oct 07 '11 at 11:02
  • 1
    Are you listening for the events on the NativeWindow object? If I recall correctly, windows should dispatch their own activate/deactivate events, which are separate form the application activate/deactivate events. – Joe Ward Oct 07 '11 at 16:38
  • @JoeWard: if you want to add that as a "Answer" I can click it. It seems that even though the stage is attached to the NativeWindow, stage does not get informed when the NativeWindow is activated. Thank you. – WORMSS Oct 09 '11 at 09:35

1 Answers1

1

Listen for window activation events directly on the NativeWindow object. (All display objects dispatch activation/deactivation events, but these are triggered by the application -- or SWF object in the browser -- getting or losing the OS focus.)

Joe Ward
  • 749
  • 4
  • 7