Created
February 3, 2016 02:31
-
-
Save audinue/54e082e32a00f9113ded to your computer and use it in GitHub Desktop.
Drag move NativeWindow manually in AIR (doesn't use NativeWindow.startMove()).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flash.events.MouseEvent; | |
import flash.geom.Point; | |
import flash.display.NativeWindow; | |
var down:Boolean = false; | |
var offset:Point = new Point(); | |
stage.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void { | |
down = true; | |
var p:Point = new Point(e.stageX, e.stageY); | |
p = stage.nativeWindow.globalToScreen(p); | |
offset.x = p.x - stage.nativeWindow.x; | |
offset.y = p.y - stage.nativeWindow.y; | |
}); | |
stage.addEventListener(MouseEvent.MOUSE_MOVE, function(e:MouseEvent):void { | |
if(down) { | |
var p:Point = new Point(e.stageX, e.stageY); | |
p = stage.nativeWindow.globalToScreen(p); | |
stage.nativeWindow.x = p.x - offset.x; | |
stage.nativeWindow.y = p.y - offset.y; | |
e.updateAfterEvent(); | |
} | |
}); | |
stage.addEventListener(MouseEvent.MOUSE_UP, function(e:MouseEvent):void { | |
down = false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment