Disable keypress


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?



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

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.

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! :slight_smile:

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


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]


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.


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.

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]