I am trying to resolve a problem with key captures on several layers of a project (actually several projects, a loader and a player with button emulation…) Anyway, the problem is that I have a player, similiar to a portable phone and I need to emulate keypresses on children SWFs. I don’t think I can force the Key object to fire off a onKeyDown or onKeyUp event. If I can, that would be my solution.
Thinking that I can’t force fire a Key Object event, I went about making up a new class to relay key events. I need to do this to add in functions and functionality to mimic key events. Instead of the child SWFs listening to the Key object, they would have to listen to my KeyCapture Object. The only thing is, I don’t know how to create a base _global object, like Key in _global scope and only one shared instance of this. I want them to be able to type KeyCapture.addEventListener(this); and listen for this object to fire them keycodes. I can then implement my own functions on this KeyCapture object to relay artificial keystrokes and the child objects wouldn’t be able to distinguish between a Key event and my KeyCapture event. The KeyCapture Object would relay all normal Key events, as well as fire it’s own Key events.
Of course, if anyone knows of a way that I can force the Key object to trigger one of it’s events, that may solve all my issues.
I would like to know how to create a base object though (like Key) if possible.