Hi List, I have this class wich put an inputtextfield on stage. But it does not accept all keypresses?
Any ideas how to do this right? TIA <AS FILE> package { import flash.display.*; import flash.events.*; import flash.text.*; public class KeyboardEventTextInput extends Sprite { private var inputTextField:TextField; public function KeyboardEventTextInput() { inputTextField = createTextField(10, 45, 100, 20); inputTextField.maxChars = 40; inputTextField.wordWrap = true; inputTextField.type = TextFieldType.INPUT; addChild(inputTextField); stage.focus = inputTextField; inputTextField.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler); inputTextField.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler); inputTextField.addEventListener(Event.CHANGE, changeHandler); } private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField { var result:TextField = new TextField(); result.x = x; result.y = y; result.width = width; result.height = height; result.background = true; result.border = true; addChild(result); return result; } private function keyDownHandler(e:KeyboardEvent):void { trace("keyDownHandler: " + e.keyCode); trace("ctrlKey: " + e.ctrlKey); trace("keyLocation: " + e.keyLocation); trace("shiftKey: " + e.shiftKey); trace("altKey: " + e.altKey); } private function keyUpHandler(e:KeyboardEvent):void { trace("keyUpHandler: " + e.keyCode); } private function changeHandler(e:Event):void { trace("changeHandler: " +e.target.text); } } } </AS FILE> _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders