2009
03.24

When you create a popup, you may not want to allow the user to drag it wherever they want. There is a simple fix for this, but for some reason my search engine magic took much to long to find it. Event then, I stumbled on it thanks to a post about the panel class itself, not anything to do with dragging or moving panels. When a panel drags, there are two functions called, startDragging, and stopDragging. In case you’re missing the obvious, startDragging is called when dragging starts, and stopDragging when the user releases the panel.

So how do we prevent dragging? We simple override the startDragging function with empty space.

?View Code ACTIONSCRIPT
override protected function startDragging(event:MouseEvent):void
{
    //Nothing here, we're just killing the parent's functionality
}

This obviously works for anything derived from the Panel class. In my case it was TitleWindow.

Related Posts (generated):

No Comment.

Add Your Comment

Switch to our mobile site