Hi experts,
I have a class inheriting TitleWindow, and I add the following code to enable
drag/drop of the title window by press on the title bar:
private function onCreationComplete(evt:Event):void
{
this.titleBar.addEventListener(MouseEvent.MOUSE_DOWN, startDragWin);
this.titleBar.addEventListener(MouseEvent.MOUSE_UP, stopDragWin);
this.titleBar.addEventListener(MouseEvent.MOUSE_OUT, stopDragWin);
this.addEventListener(DragEvent.DRAG_DROP,
moveSelf);
}
private function moveSelf(evt:DragEvent):void
{
this.x = evt.stageX;
this.y = evt.stageY;
}
private function startDragWin(evt:MouseEvent):void
{
this.startDrag();
}
private function stopDragWin(evt:MouseEvent):void
{
this.stopDrag();
}
I added the object as the top level child of an application. However the
settings of x and y are not working. The window is not moved.
I have been confused for long. Any possible reason?
Layout of application is: layout="absolute"
The following attributes were set for the title window in the MXML of the
application
<MyTitleWindow backgroundAlpha="0.5" bottom="10" right="10" width="400"
height="300"...>
I guess these initial settings don't matter at all.
Please suggest. Thanks in advance.