The following example shows how you can create a flex alert control that isn't draggable by listening forMousedown
Event and callingStopimmediatepropagation ()
Method in the event handler.
Full code after the jump.
<? XML version = "1.0" encoding = "UTF-8" ?>
<! -- Http://blog.flexexamples.com/2008/03/21/creating-an-undraggable-alert-control-in-flex/ -->
< MX: Application Xmlns: MX = "Http://www.adobe.com/2006/mxml"
Layout = "Vertical"
Verticalalign = "Middle"
Backgroundcolor = "White" >
<MX: script>
<! [CDATA [
Import MX. Controls. Alert;
Private function draggablealert (): void {
Alert. Show ("drag me! ");
}
private function undraggablealert (): void {
var alert: Alert = alert. Show ("drag me! ");
alert. addeventlistener (mouseevent. mouse_down, alert_mousedown, true);
}
Private function alert_mousedown (EVT: mouseevent): void {
EVT. stopimmediatepropagation ();
}
]>
</MX: script>
< MX: applicationcontrolbar Dock = "True" >
< MX: button Label = "Draggable alert"
Click = "Draggablealert ();" />
< MX: button Label = "Undraggable alert"
Click = "Undraggablealert ();" />
</ MX: applicationcontrolbar >
</MX: Application>
from: http://www.cnblogs.com/taobataoma/archive/2008/08/28/1278192.html