A: 

Place your SWF Embed before any other JavaScript.

swfobject.embedSWF( "tmp.swf",
                            "f2",
                            "100%",
                            "20px",
                            "9.0.0.0", null, {}, {}, {} );

I would try it outside of all functions or in a document ready jQuery function because Flash gets a z-index of infinity and should accept key strokes before anything else unless it is not yet present when the first keyup occurs.

My guess is that the first key up is occurring before anything is able to receive it. Try your keyup event trigger with jQuery in an on document ready function.

Todd Moses
Thank you. I've read your response a few times, and I think you think the problem is only at loading time. Please correct me if I am wrong. Once loaded, the problem occurs repeatedly -- you can give focus to another html div, and then click/type on flash to play "lose the keyup".
jedierikb
+1  A: 

Here is what I expect is going on: You keypress while focus is in html. You click the flash object and focus goes to that. When the key is lifted, because the html no longer has focus, it doesn't know about the key up. You could easily test this by doing the same thing only instead of clicking on the flash object, click on another window and try the same thing, because that is effectively what is happening.

As for the key up event not happening in flash, that is likely because it doesn't generate key up events without getting a key down, which it never got because focus was still in html.

I can think of two possible solutions to this. The first is to make sure that the flash object starts with focus. The second is to overlay an empty div over the flash object so it never receives focus.

Russell Leggett
Regarding your second suggestion - an empty div on top of the swf - this works, but being forced to use compatible embed modes makes performance suffer. Regrettable.
jedierikb
Regarding your first suggestion, if your embedded flash is just one of many elements on a page, then Adobe's suggestion has limited utility.
jedierikb