# Disable keypress

**URL:** https://forum.kirupa.com/t/disable-keypress/2527
**Category:** Uncategorized
**Created:** [March 20, 2002, 1:40am UTC](https://forum.kirupa.com/t/disable-keypress/2527 "2002-03-20T01:40:48Z")
**Posts on this page:** 9
**Page:** 1

<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: [March 20, 2002, 1:40am UTC](https://forum.kirupa.com/t/disable-keypress/2527/1 "2002-03-20T01:40:48Z")

</div>

Hi,

Is there a way to stop keyboard input? I have a game where a user moves an object on the stage using the arrow keys. I want the object to stop moving upon collision, but I don’t know how to tell flash to stop accepting keypresses. Any help?

Thanks!

Scigolf

---

<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: [March 20, 2002, 8:32am UTC](https://forum.kirupa.com/t/disable-keypress/2527/2 "2002-03-20T08:32:07Z")

</div>

I figured out a way to do it… you want something like this right?

\<embed src=“[http://www.angelfire.com/dc/vidgame/tutorials/hittest.swf](http://www.angelfire.com/dc/vidgame/tutorials/hittest.swf)” height=100 width=200\>\</embed\>

I made a MC with A button in Frames 1 and 2. In frame one the button has the KeyPress code, in the second frame it doesnt. Then a stop command in each frame. Then for the hit test, just tell the MC to goto and stop frame 2

here is the fla

[click here for FLA!!](http://www.angelfire.com/dc/vidgame/tutorials/hittest.html)

there might be an easier way, but this works for me and it might work for you.

to get the animation to work, click on the box first.

---

<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: [March 20, 2002, 8:39am UTC](https://forum.kirupa.com/t/disable-keypress/2527/3 "2002-03-20T08:39:53Z")

</div>

dam, it feels good to be able to answer questions and actually be able to test the things that i’m trying to answer. No more wrong answers from jubba! 🙂

---

<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: [March 20, 2002, 5:58pm UTC](https://forum.kirupa.com/t/disable-keypress/2527/4 "2002-03-20T17:58:40Z")

</div>

oh yeah, you could also use if statements, but that requires more code.

---

<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: [March 21, 2002, 4:54am UTC](https://forum.kirupa.com/t/disable-keypress/2527/5 "2002-03-21T04:54:49Z")

</div>

DID THIS HELP YOU!?!

---

<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: [March 21, 2002, 5:05am UTC](https://forum.kirupa.com/t/disable-keypress/2527/6 "2002-03-21T05:05:38Z")

</div>

Don’t you just hate this ?? You worked your as off for someone who probably posted in every Flash forum he could fine, and who will probably never check that post again…

Be strong Jubby Boy !

pom 0]

---

<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: [March 21, 2002, 12:28pm UTC](https://forum.kirupa.com/t/disable-keypress/2527/7 "2002-03-21T12:28:46Z")

</div>

Hi,

Yes, thanks for your help! It did work and I am currently looking at incorporating it into my program. Thanks again!

I’m sorry that my response wasn’t timely. I have other areas in my life (family, job) which often require more attention than my current hobby (flash). And , no, ilyaslamasse, I did not post in all the forums I could find, just this one.

Scigolf

---

<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: [March 21, 2002, 1:11pm UTC](https://forum.kirupa.com/t/disable-keypress/2527/8 "2002-03-21T13:11:32Z")

</div>

thats ok. Its just that if I respond to someone, I like to know if what i told them helped. I didn’t really work my ass off, because as soon as i read his post I knew what to do, and then it only took 3 minutes to do it. So it wasn’t a big deal. I’m glad I helped. good luck. Oh, and don’t listen to Pom, he’s just mad at the world because he’s French.

---

<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: [March 21, 2002, 8:23pm UTC](https://forum.kirupa.com/t/disable-keypress/2527/9 "2002-03-21T20:23:01Z")

</div>

Totally correct, Jubby. And moreover I was tired when I wrote that. So don’t listen to me too much.

I really sounded sarcastic, didn’t I ? Sorry about that.

pom 0]
