This content has been marked as final. Show 7 replies
What is the datatype of myParent? does it accept Keyboard event?
If you are trying to track the event on the child of myParent, you need to use useCapture as true. Can you try
myParent.addEventListener (KeyboardEvent.KEY_DOWN, downKeys, true);
myParent is type Sprite. I'm looking at the docs, but I'm not seeing the answere to the question about accepting Keyboard events...I'm sure its there, but I'm looking in the wrong place.
At any rate, I tried the useCapture param, and that didn't seems to make any difference.
I'm not sure what other info I can give to help you help me, but whatever you ask for, I will do my best to give.
Why are you using Sprite? It is not usual to use sprite in a flex app unless you are doing drawing.
What exactly are you trying to do?
I am using flex(and eventually air) to experiment with a design for a tile-based game engine that I am writing.
So, my code intends to use the keyboard for movement of the 'hero'. As I said, the other event (the main event 'loop') fires just fine, so its the listeners based on KeyboardEvent which are not firing.
Hey, maybe the keyboard-events are not working because your sprite-component doesn't have the focus, try to give your sprite the component.
Just a guess, not tested
I tried this, but I have to admit that I don't know what I'm doing. I don't know how to give the sprite object the focus.
but that didn't have any impact.
Any other thoughts?
No other thoughts?