Add Mouse Down listener to TitleWindow
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="init(event)">
<mx:Script>
import mx.controls.Alert;
import flash.events.MouseEvent;
import flash.events.Event;
public function init(e:Event):void {
p1.addEventListener(MouseEvent.MOUSE_DOWN,showAlert);
tw1.addEventListener(MouseEvent.MOUSE_DOWN,showAlert);
}
public function showAlert(e:Event):void {
Alert.show(e.currentTarget + "\n" + e.eventPhase);
e.stopImmediatePropagation();
}
</mx:Script>
<mx:Panel id="p1" title="Panel 1">
<mx:TitleWindow id="tw1" width="300" height="300" showCloseButton="true" title="Title Window 1">
<mx:Button label="Enter name" />
<mx:TextArea id="ta1" />
</mx:TitleWindow>
</mx:Panel>
</mx:Application>
Related examples in the same category