Resize AIR app window while dragging

Posted by matt lohkamp on Stack Overflow See other posts from Stack Overflow or by matt lohkamp
Published on 2010-04-02T21:05:41Z Indexed on 2010/04/06 7:13 UTC
Read the original article Hit count: 218

So I've noticed Windows 7 has a disturbing tendency to prevent you from dragging the title bar of windows off the top of the screen. If you try - in this case, using an air app with a draggable area at the bottom of the window, allowing you to push the top of the window up past the screen - it just kicks the window back down far enough that the title bar is at the top of what it considers the 'visible area.'

One solution would be to resize the app window as it moves, so that the title bar is always where windows wants it. How would you resize the window while you're dragging it, though? Would 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;
});

see what's going on there? When I click, I'm doing startMove(), which is hooking into the OS' function for dragging a window around. I'm also increasing and decreasing the height of the window by 50 pixels - which should give me no net increase, right?

Wrong - the first '.height +=' gets executed, but the '.height -=' after the .startMove() never runs.

Why?

update - If you're curious, I'm programming an air widget with fly-out menus which expand rightwards and upwards - and since those element can only be displayed within the boundaries of the application window itself (even though the window is set to be chromeless and transparent) I have to expand the application's borders to include the area that the menu 'pops up' into. In the extreme case, with the widget positioned bottom left, and the menus expanded completely across to the right side and top edge of the screen, the application area could very well cover the entire desktop. The problem is, when it's expanded like this, if the user drags it up and to the right, it causes the 'title bar' area of the application window to move above the top edge of the desktop area, where it would normally be unreachable; and Windows automatically re-positions the window back below that edge once the .startMove() operation is completed.

So what I want to do is continually resize the height of the application so that the visual effect will be the same for the user, but for the benefit of the operating system the window's title bar will never be above that top boundary of the desktop area.

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about as3