00:00
00:00
Newgrounds Background Image Theme

Inkolypso 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!

Foss: Anti Offscreen Clicking

1,720 Views | 10 Replies
New Topic Respond to this Topic

Foss: Anti Offscreen Clicking 2005-11-13 01:01:48


Foss: main
The title may be misleading. you cant really stop themouse from leaving, i just could fit a better title in.

Ok lets say you playing madness, and you clicking at like 400 times per second, whops you clicked a different window, or your freind im'd you. now the key's are unresponsive. until you find the window and click back on. madness fans know exactly what im talking about. Well, to my knowledge there is no way to stop the mouse from leaving the screen, but heres the next best thing. this finds whether or not your mouse is in bounds of the flash game. other wise it pauses it.

NOTE: as far as i know there is no pause function so for this to work you have to put a if(_root.gamePaused){} thing on them. i know its alot of work but you should really put a pause function on your games anyways.

_root.createEmptyMovieClip("impBackButton"
, -100000000);
_root.impBackButton.beginFill(0, 0);
_root.impBackButton.lineTo(Stage.width, 0);
_root.impBackButton.lineTo(Stage.width, Stage.height);
_root.impBackButton.lineTo(0, Stage.height);
_root.impBackButton.lineTo(0, 0);
_root.impBackButton.useHandCursor = false;
//draws a button under all your movieClips and hides the fingerCursor
_root.impBackButton.onRollOver = function() {
_root.gamePaused = false;
};
//mouse is on screen
_root.impBackButton.onRollOut = function() {
_root.gamePaused = true;
};
//mouse is off screen

this isn't a complicated code at all. i just thought i'd throw it out there.

ill have a better sample later

Response to Foss: Anti Offscreen Clicking 2005-11-13 01:33:21


At 11/13/05 01:01 AM, ImpotentBoy2 wrote: _root.createEmptyMovieClip("impBackButton"
, -100000000);

generally speaking, flash does not play well when you use negative depth, but it works, and its actually a genius idea. great work, in any case.


BBS Signature

Response to Foss: Anti Offscreen Clicking 2005-11-13 01:39:54


At 11/13/05 01:33 AM, authorblues wrote:
At 11/13/05 01:01 AM, ImpotentBoy2 wrote: _root.createEmptyMovieClip("impBackButton"
, -100000000);
generally speaking, flash does not play well when you use negative depth, but it works, and its actually a genius idea. great work, in any case.

i was afraid of that, but of course i couldnt have a button over everthing. and im glad you liked it.

Response to Foss: Anti Offscreen Clicking 2005-11-13 01:48:44


At 11/13/05 01:39 AM, ImpotentBoy2 wrote: i was afraid of that, but...

sort of a catch-22, if you will.


BBS Signature

Response to Foss: Anti Offscreen Clicking 2005-11-13 04:57:45


There is one problem; Hovering over another button would count as a rollOut on the impBackButton. That counts for selectable text too, like the one you have in your example. If you hover over the true/false text field, it changes to true. This is something that might cause problems.


BBS Signature

Response to Foss: Anti Offscreen Clicking 2005-11-13 14:38:52


crap,this is gonna take a while to fix

Response to Foss: Anti Offscreen Clicking 2005-11-13 14:40:29


At 11/13/05 02:38 PM, ImpotentBoy2 wrote: crap,this is gonna take a while to fix

i know, ive been working on it for an hour as well


BBS Signature

Response to Foss: Anti Offscreen Clicking 2005-11-13 14:49:23


lol i figured it out. there really is no reason for selectable text, so just make all text nonSelectable and put this code for all the buttons
_root.impBackButton.onRollOver = function() {
_root.gamePaused = false;
};

Response to Foss: Anti Offscreen Clicking 2005-11-13 14:50:30


oops well really it would most likely be
on (rollOver) {
_root.gamePaused = false;
}

didnt mean to put the impbutton name on it

Response to Foss: Anti Offscreen Clicking 2005-11-14 03:15:13


But what if I want selectable text?!?!?!

No, just messing with you, it's ok.


BBS Signature

Response to Foss: Anti Offscreen Clicking 2005-11-14 03:42:41


Why don't you post this stuff on Burstfilms?

This is fucking great man...definitly a must for all future games involving mouse movement. Genious bro.


BBS Signature