所以我注意到 Windows 7 有一种令人不安的趋势,即阻止您将窗口的标题栏拖离屏幕顶部。如果您尝试 - 在这种情况下,使用窗口底部带有可拖动区域的 air 应用程序,允许您将窗口顶部向上推过屏幕 - 它只会将窗口踢回足够远的标题栏位于它认为的“可见区域”的顶部。
一种解决方案是在移动时调整应用程序窗口的大小,以便标题栏始终位于窗口需要的位置。但是,如何在拖动窗口时调整窗口大小?你会这样做吗?
dragHitArea.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{
stage.nativeWindow.height += 50;
stage.nativeWindow.startMove();
stage.nativeWindow.height -= 50;
});
看看那里发生了什么?当我单击时,我正在执行 startMove()
,它连接到操作系统的功能中,用于在周围拖动窗口。我还将窗口的高度增加和减少 50 像素 - 这应该不会给我净增加,对吗?
错误 - 第一个 '.height +=
' 被执行,但是 .startMove()
之后的 '.height -=
' > 从不运行。
为什么?
最佳答案
您是否尝试查看 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 }
引用资料:谷歌,这让我找到了 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 事件
(顺便说一下,我很想直接说“你不能”而不做任何关于赏金的研究……但我觉得那会很刻薄)
关于flash - 拖动时调整 AIR 应用程序窗口的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2569207/