i've created a simple panel with a title bar, and i'm trying to share the title bar between MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_CLICK and MouseEvent.DOUBLE_CLICK. oh mouse down, the panel is draggable, on mouse click the panel collapses and expands, and on mouse double click the panel is hidden.
i'm struggling to make these all work with the same title bar sprite of the panel. mouse down activates a click when the mouse is up, etc. is it possible to have these mouse events distinguishable on the same object?
i forgot to mention that i'm programming an AIR application, so while i believe PatrickS's solution below would work for a regular .swf file or one that has custom drag and drop functions, i don't really have access to the nativeWindow's startMove() function. however, i've managed to share the panel's titleBar object between MOUSE_DOWN and MOUSE_CLICK events by polling for the position of the nativeWindow.
private function titleBarMouseDownEventHandler(evt:MouseEvent):void
{
windowCoords = new Point(stage.nativeWindow.x, stage.nativeWindow.y);
stage.nativeWindow.startMove();
}
private function titleBarClickEventHandler(evt:MouseEvent):void
{
if (stage.nativeWindow.x != windowCoords.x && stage.nativeWindow.y != windowCoords.y)
return;
//expand & collapse code
}