[flexcoders] Can't move titlewindow in an Application

2010-03-05 Thread xmwang1982
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.



Re: [flexcoders] Can't move titlewindow in an Application

2010-03-05 Thread claudiu ursica
in creation complete add this.isPopUp = true;
Make sure u get rid of all the listeners ...
C





From: xmwang1982 ask...@gmail.com
To: flexcoders@yahoogroups.com
Sent: Fri, March 5, 2010 4:30:30 PM
Subject: [flexcoders] Can't move titlewindow in an Application

   
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.addEventListen er(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.