00:00
00:00
Newgrounds Background Image Theme

MoxKatt just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Restrict Cursor 2014-09-20 21:05:54


Okay, I give up. I'm losing my mind...

How do I restrict the movement of my cursor in a flash? I want my mouse cursor to EITHER not pass a certain movieclip or not pass a certain stage height. It seems like such a simple thing to code, but after browsing for 2 hours I still haven't gotten the faintest clue.

Pls? <3


BBS Signature

Response to Restrict Cursor 2014-09-20 21:26:25


At 9/20/14 09:05 PM, test-object wrote: Okay, I give up. I'm losing my mind...

How do I restrict the movement of my cursor in a flash? I want my mouse cursor to EITHER not pass a certain movieclip or not pass a certain stage height. It seems like such a simple thing to code, but after browsing for 2 hours I still haven't gotten the faintest clue.

Pls? <3

I don't think you can control the cursor, unless you make your own fake cursor.

Response to Restrict Cursor 2014-09-20 21:35:42


At 9/20/14 09:26 PM, MSGhero wrote: I don't think you can control the cursor, unless you make your own fake cursor.

That would explain the lack of findings. If this is true, it's very odd, though.


BBS Signature

Response to Restrict Cursor 2014-09-20 21:36:41


At 9/20/14 09:05 PM, test-object wrote: Okay, I give up. I'm losing my mind...

How do I restrict the movement of my cursor in a flash? I want my mouse cursor to EITHER not pass a certain movieclip or not pass a certain stage height. It seems like such a simple thing to code, but after browsing for 2 hours I still haven't gotten the faintest clue.

Pls? <3

Yeah, I know that you can replace the cursor in a flash program with a different image and you can simply make that image follow the mouse movements.

All of that other stuff can just be applied to the object such as binding it within the game's borders or not letting it get past a wall. I guess you might have to work around mouse events, too. That wouldn't be hard, either.

Here's a tut for making the custom cursor.

Response to Restrict Cursor 2014-09-20 21:49:00


At 9/20/14 09:36 PM, Barzona wrote:
At 9/20/14 09:05 PM, test-object wrote: Okay, I give up. I'm losing my mind...

How do I restrict the movement of my cursor in a flash? I want my mouse cursor to EITHER not pass a certain movieclip or not pass a certain stage height. It seems like such a simple thing to code, but after browsing for 2 hours I still haven't gotten the faintest clue.

Pls? <3
Yeah, I know that you can replace the cursor in a flash program with a different image and you can simply make that image follow the mouse movements.

All of that other stuff can just be applied to the object such as binding it within the game's borders or not letting it get past a wall. I guess you might have to work around mouse events, too. That wouldn't be hard, either.

Here's a tut for making the custom cursor.

is there any advantages of that tutorial over
Mouse.hide();
cursorskin.startDrag(true);
?

Also, it's mostly the collision which has been bothering me.


BBS Signature

Response to Restrict Cursor 2014-09-20 22:04:45


You can't, if you could any old random flash could just take the users mouse control away. It's a security thing.

You can however use mouselock in AS3 in fullscreen mode.

And there is a benefit to resetting X/Y rather than startDrag. With startDrag if focus is lost then you can expect weird things to happen. With resetting the X/Y normal behavior will resume when the window is brought back into focus.


If ya have something to say, PM me. I have a lot of time to spare.

Also never PM egg82.

BBS Signature

Response to Restrict Cursor 2014-09-20 22:21:04


At 9/20/14 09:49 PM, test-object wrote: Also, it's mostly the collision which has been bothering me.

This will have to do with how you balance the behavior of your new cursor object, especially in instances when the actual mouse loses focus, like Mint mentioned. In that situation, you'd want the object to, maybe, stop moving entirely, or you could have it float to a different position.

I think you'd be better off having the object follow your mouse with some easing instead of startDrag. You'd want this to be really controlled so that the object couldn't just clip through walls and such.

I'm not super up to speed on mouse manipulation, myself.

Response to Restrict Cursor 2014-09-20 22:21:11


At 9/20/14 10:04 PM, MintPaw wrote: ...

Alright, will figure it out from here. Thank you all for your enlightenment!


BBS Signature