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.