views:

60

answers:

3

Hi guys, I have to resort to you again.

Is there a way to lock the mouse X and Y position?, I mean, I want to move my mouse but I want that the mouse position to be locked on.. let say, the center of the screen.

Btw, I need to do this using Flash.

If there is ANY workaround, i.e, using JS or something like that, would be appreciated.

Thx.

A: 

how can you move your mouse if it's locked to the center of the screen?

tom
This probably should have been a comment. It does nothing to answer the question.
Wilduck
What I meant was, I use the X and Y movement inputs to do something else rather than updating the X and Y pointer position.
Artemix
+2  A: 

Use mouse.hide() to hide the cursor, go full screen, and draw your own "cursor" wherever you want it. The farthest the real cursor will go is to the edge of the screen anyway, so the user will be able to find their mouse again when they're done playing.

Marcus Adams
Woot, didn't think of that.I definitely try it out!, thx.
Artemix
Cuz, if I reach the limit of the screen, I cant use the coordinates to do anything, cuz the coordinates are still the same.
Artemix
This is probably the only way to do it. http://www.webdeveloper.com/forum/showthread.php?t=52967 and other research shows that JS can't set mouse position either. Which makes sense..otherwise we'd see a bunch of ads(flash, js) repositioning our cursor when surfing. C/C++/C# games simply move the mouse to the center of the screen every few miliseconds.
Caladain
What about Air?, maybe if users download the game more options are available, who knows.Anyway, I found that you can write a plugin to do so, but.. yes, I think it could be very difficult to do.
Artemix
A: 

One thing you CAN do is hide the mouse cursor and draw your own. That probably doesn't help you, but on the off-chance it does I want to make sure you know it's possible. Then you can keep track of mouseX and mouseY on a MouseEvent.MOUSE_MOVE and update its position according to your needs - does that make sense?

But Flash doesn't let you actually capture and control the user's mouse on a system level. Just imagine the potential for abuse.

Myk
Yes I know what you're saying, but just like Marcus said, I cant catch AFAIK a mouse increment, only a mouse position, so, whenever the position reachs his limit, I cant use it anymore.
Artemix