Khalid Bajwa
Khalid Bajwa

Reputation: 173

How to detect clicks outside of a window for a multi-window AIR app in flex?

So I have this AIR app coded in flex where I have several floating native windows and what I want is to detect when a user clicks outside of a window so that I can close it. (I don't want to use the PopupManager Class and would want to use the native windows).

My question is, is there a way to detect a click outside of a spark window, or alternativley is there some root container/object which is a parent to all the native windows so that a click inside any native window would bubble up to it? (Apparently the stage object of the root windowed application is not that object since each window is not a child of the stage for the root application).

Upvotes: 2

Views: 387

Answers (1)

Scott
Scott

Reputation: 17037

You should use the deactivate event on the component you want to respond to losing active context to the user.

For example

private function startPause(e:MouseEvent):void{
        //pause doing memory intensive stuff
}

<mx:VBox paddingLeft="20" deactivate="startPause(null)">

Upvotes: 3

Related Questions