# Code to focus on input box (disable keypress)?

**URL:** <https://forum.kirupa.com/t/code-to-focus-on-input-box-disable-keypress/65966>\
**Category:** flash\
**Created:** [October 1, 2004, 12:46am UTC](https://forum.kirupa.com/t/code-to-focus-on-input-box-disable-keypress/65966 "2004-10-01T00:46:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@Brandon](https://forum.kirupa.com/u/Brandon)\
**Post date:** [October 1, 2004, 12:46am UTC](https://forum.kirupa.com/t/code-to-focus-on-input-box-disable-keypress/65966/1 "2004-10-01T00:46:04Z")

</div>

is there a code that will disable key press all together or to focus on just the input box so that i can type with the space key (space is used to pick objects up in game not in use when this menu is open anyway).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 2, 2004, 3:48am UTC](https://forum.kirupa.com/t/code-to-focus-on-input-box-disable-keypress/65966/2 "2004-10-02T03:48:16Z")

</div>

someone please help me, why do you people do this, why? (sry for the laps of sanity okay got to work, please answer).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 3, 2004, 9:17am UTC](https://forum.kirupa.com/t/code-to-focus-on-input-box-disable-keypress/65966/3 "2004-10-03T09:17:50Z")

</div>

I don’t quite understand, do you want to disable the pick-up-command when you’re typing? Just put an if-condition inside the onkeypress(“space”) that checks if a variable is true, and set the variable to true when you set focus to a textbox…[AS]TextField.onSetFocus = function(){  
\_root.disablespace = true;  
};[/AS]Then you can set it to false when you loose focus:[AS]TextField.onKillFocus = function () {  
\_root.disablespace = false;  
}; [/AS]Does this answer your question or did I misunderstand you?
