[SOLVED]Locking the Mouse

Bisser777

  • Posts: 109
Is it possible to lock the mouse so it no longer moves in the browser?
Sort of like any in browser FPS game would (I am not making however a 3D game).

If it is possible, I still want to be able to get values of the movement of the mouse. So is that possible?

Thanks in advance for your help.

« Last Edit: August 23, 2013, 10:40:04 pm by Bisser777 »

Photon

  • Posts: 2691
Do you mean where the mouse doesn't show up outside of the flash screen/window?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

Bisser777

  • Posts: 109
More like how the mouse will remain static in the browser but keep outputting data to the game.

Much like how the in-browser single player minecraft does.

Once you play the game, you can move your mouse freely without it going all over the place.

Bisser777

  • Posts: 109
I was able to fin this. Any way I can put it into Stencyl?

Mouse lock:

A new mouseLock property has been added to Stage. To enable mouse locking set Stage.mouseLock to true. There are several rules which are applied here:

This property can only be set in full screen mode.
It dispatches a runtime exception if it is called in non-full screen mode.
On mobile settings this property always throws an exception. The reason is simple: This feature can only work with a mouse typeof devices and mobile devices do not have such a thing.
The property can be read in non-full screen mode. This allows developers to easily dispatch to alternative input methods if mouse locking is disabled externally for some reason.
When exiting full screen mode Stage.mouseLock is automatically set to false. Note that while in full screen mode mouse event listeners attached to other display objects but the stage will not be dispatched.
In other words to receive mouse deltas and any other mouse event while mouseLock is active you need to attach your mouse event listeners to the stage.
Relative mouse coordinates - New properties (movementX and movementY) on MouseEvent:



http://www.bytearray.org/?p=3755

Bisser777

  • Posts: 109

t4u

  • Posts: 418
Bump of Justice

Do you mean locking mouse in browse or in game window? if in game window upon locking you hide mouse and create "mouse pointer actor" at x and y of mouse
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

Bisser777

  • Posts: 109
Replacing the mouse with my actor isn't my issue.
I simply want to be able to lock the mouse.

I'll be playing with moving the mouse around, so it is currently out of sync with the actual mouse, and going near the edges well.. makes the mouse leave the game.

To answer your question, in game window I guess.

rob1221

  • *
  • Posts: 9473
Flash does not permit what you're trying to do.

Bisser777

  • Posts: 109
That sucks :\

Thanks anyways.