# Disabling keyboard and mouse input

**URL:** <https://forum.kirupa.com/t/disabling-keyboard-and-mouse-input/258613>\
**Category:** flash\
**Created:** [April 25, 2008, 5:50pm UTC](https://forum.kirupa.com/t/disabling-keyboard-and-mouse-input/258613 "2008-04-25T17:50:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dzhedzho](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@dzhedzho](https://forum.kirupa.com/u/dzhedzho)\
**Post date:** [April 25, 2008, 5:50pm UTC](https://forum.kirupa.com/t/disabling-keyboard-and-mouse-input/258613/1 "2008-04-25T17:50:34Z")

</div>

Hello guys, I am trying to display a modal dialog. What this means is that I need to disable mouse and keyboard input from anything else but that MovieClip. Any Ideas? Currently what I was trying was to is loop through all children in the stage and set mouseEnabled to false for all byt the dialog. I have no idea how to disable keyboard imput though. I tried

```
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]KeyboardEvent.[COLOR=#000080]KEY_DOWN[/COLOR],preventKey,[COLOR=#000000] **true** [/COLOR][COLOR=#000000])[/COLOR];

```

[COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]stage[/COLOR].[COLOR=#000080]addEventListener[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000] **function** [/COLOR] preventKey COLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR] [COLOR=#000000]{[/COLOR]  
evt.[COLOR=#000080]stopImmediatePropagation[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

thought that did not work…  
Any idea how to do that?
