My guess is that the button has the focus at that particular moment.
So maybe you can set button.mouseEnabled = false;
And set a listener to enable the button on pe. if mouseX and mouseY is at a
specific point.

HTH

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Paul Steven
Sent: woensdag 2 december 2009 10:27
To: 'Flash Coders List'
Subject: [Flashcoders] Prevent space button passing click event to button
(as3)

I have created a game in AS3 that uses the "SPACE" bar on the keyboard to
make the character jump. I have encountered a problem whereby pressing the
"SPACE" bar causes a button on my game screen to be clicked.

I read up that setting buttonMode to false would fix this but it does not
seem to like me using this property on my button.

i.e I tried gameMenuBtn.buttonMode = false;

but here is the error message:

1119: Access of possibly undefined property buttonMode through a reference
with static type flash.display:SimpleButton.

My button is a custom button I have created and not a button from the
components library i.e I just selected a graphic and converted to a symbol
and choose "Button".

Any ideas how to prevent this button being clicked by the "SPACE" bar being
pressed? I could change the key for jumping but feel that the "SPACE" bar is
the standard one used for this.

Thanks

Paul

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 9.0.709 / Virus Database: 270.14.89/2539 - Release Date: 12/01/09
20:32:00

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to