锁定鼠标位置
我不得不再次求助于你。
有没有办法锁定鼠标的 X 和 Y 位置?我的意思是,我想移动鼠标,但我希望将鼠标位置锁定在..比如说屏幕的中心。
顺便说一句,我需要使用 Flash 来完成此操作。
如果有任何解决方法,即使用 JS 或类似的东西,将不胜感激。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用
mouse.hide()
隐藏光标,进入全屏,并在任何你想要的地方绘制你自己的“光标”。无论如何,真实光标最远的位置是屏幕边缘,因此用户在玩完游戏后将能够再次找到鼠标。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.您可以做的一件事是隐藏鼠标光标并绘制自己的光标。这可能对你没有帮助,但偶尔我想确保你知道这是可能的。然后您可以在 MouseEvent.MOUSE_MOVE 上跟踪 mouseX 和 mouseY 并根据您的需要更新其位置 - 这有意义吗?
但 Flash 不允许您在系统级别实际捕获和控制用户的鼠标。想象一下滥用的可能性。
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.