0 Replies Latest reply on Jan 10, 2007 4:07 AM by lreadl

    setFocus messes up key listener

    lreadl Level 1
      I have a textfield attached to a movieclip attached to a movieclip on the stage. I have an object set to listen for key events, and that object defines an onKeyDown function. If I run the movie and click on the textfield manually, a cursor appears in the textfield, and when I enter text the onKeyDown function executes.

      If instead I use Selection.setFocus(myTextfield), the cursor does not appear, but I can still type text in the textfield. However, this apparently makes a big difference, because now the onKeyDown function in the key-listener object does not execute. Is there a way to programmatically set focus and still have key listeners work? What is the difference between the Selection.setFocus kind of focus and the other kind of focus when a cursor appears?