Thanks Alex. That makes sense. Making some progress now. Implementing the IFocusManagerComponent allows MyComp to fire keyDown events.
But the child "MySprite" still does not receive keyboard events. Do I need to proxy keyboard events down to MySprite from MyComp, or is there a cleaner way to have the child receive Keyboard events. TIA - superabe On 2/14/07, Alex Harui <[EMAIL PROTECTED]> wrote:
In order to receive keyboard events, you have to have focus. In order to get focus in Flex, you have to implement IFocusManagerComponent. HTH, -Alex ------------------------------ *From:* [email protected] [mailto:flexcompone [EMAIL PROTECTED] *On Behalf Of *superabe superabe *Sent:* Wednesday, February 14, 2007 6:00 AM *To:* [email protected] *Subject:* [flexcomponents] Keyboard events for a custom component I am trying to create a custom component which is an AS3 class "MyComp" extending of UIComponent. MyComp composites (using addChild) another class "MySprite" that extends of Sprite. MySprite is a listener for Keyboard events and handles several key presses. The problem I see is that, when MySprite is used within MyComp, it fails to receive any Keyboard events. I tried listening for the "keyDown" event on MyComp itself, but that fails to fire too. What is the recommended approach for enabling keyboard events in custom componnets that extend UIComponent. Thanks, - superabe
