Thanks for the replies. When you say "buttons are meant to be pressed like that" - do you mean that it is standard practice to use the tab key to move between buttons and then use the SPACE key to click it?
You are correct in assuming I have a game where there is a button on the interface that allows the user to quit the game. I have the following code on this button: gameMenuBtn.addEventListener(MouseEvent.CLICK, clickGameMenuButton); function clickGameMenuButton(event:MouseEvent) { gotoAndStop("splash"); } I was hoping there was just a simple way to prevent the SPACE key from virtually clicking this button. I still want the user to be able to click it with the mouse. -----Original Message----- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson Sent: 02 December 2009 10:11 To: Flash Coders List Subject: Re: [Flashcoders] Prevent space button passing click event to button (as3) Buttons are meant to be pressed like that. You are using the wrong object for the job. Here is my take on it: you have a game where there are button instances in the gui. I would add the keyboard listener to the stage as usual. However, in the listener, I would add a condition to ignore events for things that actually have a logical response. if(e.target is TextField||e.target is SimpleButton||(e.target is Sprite && Sprite(e.target).buttonMode)) return; _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders