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.