Creating draggable/movable popup window in Flash Builder 4 is an easy task as long as you use TitleWindow component and, of course, PopUpManager class which, as I thought, handles the dragging part - but that's not the case! It is, in fact, implemented in TitleWindow class, so if you want to have draggable custom component inheriting from Group for example, you have to handle it Yourself.
Additionally if You want to go other way around - prevent TitleWindow from moving - you can set the titleWindow.moveArea visible property to 'false'
As I needed this for my own project, I've created a MovableGroup component (based on Group component). I copied most of the code from the TitleWidow, so it has the same properties, and generates the same events(windowMoveStart,windowMoving,windowMove,windowMoveEnd), so I can't say I wrote it realy ;). Maybe it'll be usefull for someone - the source is attached.
The main difference is that the moveArea (skin element, that is default the titleBar in TitleWindow) is set as 'this' by default (so you can move the component by clicking anywhere on it) - you can change it of course and set a diffrent InteractiveObject
Brak komentarzy:
Prześlij komentarz