Resize an AIR application window while dragging and dropping

So, I noticed that Windows 7 has an alarming tendency to stop you from dragging the window title bar from the top of the screen. If you try - in this case, to use an airborne application with a draggable area at the bottom of the window, which allows you to click on the top of the window above the screen - it just removes the window back far enough so that the title bar is at the top of what it considers the "visible area" "

One solution would be to resize the application window as you move it so that the title bar is always where the windows want it. How would you resize a window while dragging it? Will you do it like this?

dragHitArea.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
    stage.nativeWindow.height += 50;
    stage.nativeWindow.startMove();
    stage.nativeWindow.height -= 50;
});

look what is going on there? When I click, I do startMove()that which connects to the OS function to drag the window. I also increase and decrease the height of the window by 50 pixels - which should not give me any increase, right?

False - the first " .height +=" is executed, but the " .height -=" after .startMove()never starts.

Why?

+3
source share
3 answers

Have you tried to watch the event NativeWindowBoundsEvent.MOVING?

stage.nativeWindow.addEventListener (NativeWindowBoundsEvent.MOVING, windowMove);
private function windowMove (e: NativeWindowBoundsEvent): void {
    trace (e.beforeBounds);
    trace (e.afterBounds);
    // resize window as needed based on these
}

: Google, http://lowpitch.com/blog/nativewindow-using-air-windows-with-actionscript-part-3-of-3/, http://livedocs.adobe.com/flex/3/langref/flash/events/NativeWindowBoundsEvent.html

NativeWindowBoundsEvent.MOVING , , NativeWindowBoundsEvent.MOVE , . , MOVING

(, " ", ... , )

0

, , , NativeWindows . , . , , . : Canvas. , , .

, , .

0

, , . - ? , ?

-1
source

Source: https://habr.com/ru/post/1739647/


All Articles