2 Replies Latest reply on Sep 17, 2009 4:48 PM by GEGEWOO

    Focus issue of JSP and embedded Flex


      I have a Flex component embedded inside a JSP with some other HTML components. The flex component is a TextInput, included in a Vbox. What I need is when the focus is on the TextInput, and if I press TAB key, the focus should be moved out of Flex, into JSP to the next HTML component.


      The problem now is, every time I captured the KeyDown event on the Vbox (to see if it's Tab key), I try to remove the focus from that TextInput, and call a JavaScript function to set focus to next  HTML component. The code to remove focus is:


      myTextInput.stage.focus = null;


      On IE (7.0.5730.13), if I comment out this code, focus is moved to next HTML component successfully, but a mouse cursor remains in that Flex TextInput, looks like it's ready to accept user input, even the focus is actually on next HTML component. However, to result of running this code is, the Flex control gained focus automatically after lost it. I added focusIn and focusOut event handler to the Vbox and proved its happening.


      Firefox (3.0.13) behaves different from this. The TextInput can't get focus automatically, it seems like the I need to press Tab twice to move the focus from the HTML component in front of Flex conponent, (On IE, one key stroke is fine). And same problem as IE after.


      Does any one have the same issue?


      I guess Flex faces the similar problem as Java, as they declared, "Write once, run anywhere", is actually became, "Write once, debug, or maybe guess everywhere".