I'm making a 1st person shooter for Flash in Away3D, but it seems that setCursorPos isn't working properly. When I call setCursorPos, the cursor moves to the center of the screen, but also triggers a MOUSE_MOVE event. Is this expected behavior? How do I know when the MOUSE_MOVE event is caused by the setCursorPos; or whether it's caused by actual mouse movement? Here is a code sample of what I'm trying to do:
private function onMove(evt:MouseEvent):void {
if (prevY == 0) {
prevY = evt.stageY;
prevX = evt.stageX;
}
mainView.camera.rotate(Vector3D.X_AXIS,evt.stageY - prevY);
}
}
//This triggers a MOUSE_MOVE event, causing this function to be called again.
nativeInterface.setCursorPos(nativeInterface.screenResolution[0] / 2, nativeInterface.screenResolution[1] / 2);
}