This content has been marked as final. Show 6 replies
You'll need to set up a keyboard listener.
I haven't done this in 2.0, but will try to do an example tomorrow.
Ok, I'll try.
Should you try and get it b4 me, pls let me know.
Use following code for using keyboard events
import mx.controls.Alert ;
import flash.events.* ;
public function doEnter(event:KeyboardEvent):void
if(event.keyCode == 13)
Alert.show("You pressed Enter");
Alert.show("You pressed :"+event.charCode);
<mx:Button id="bt" label="press any key" click="assign1(event);" keyDown="doEnter(event);"/>
many thanks buddy.
Do any of you know if there is a way to have the button fire the buttonDown event when enter is pressed. I used the doEnter function and got that working, but it would just be so much easier to set what happens in one place in stead of having to create enterHandlers for every button I create.
To answer my earlier question, here's how you have a button respond to the enter key.
The only problem with this is that the button must have focus, which can be achieved using the focusManager, or by tabbing to it.