0 Replies Latest reply on Mar 23, 2007 9:14 AM by moccamedium

    Manually dispatching keyboard events

    moccamedium
      In the Flex Documentation there are a few examples how to manually dispatch a mouse-click event. I`m trying to achieve that for a total accessible application, so that every time the timer ticks (lets say every second) the tab-key is hit and the focus moves automatically to the next component-instance that is in the tabLoop. The problem is, that when you use a good modular design, with distributed components that you can`t use a construct like
      fok = focusManager.getNextFocusManagerComponent();
      fok.setFocus();
      because the focusmanager seems to ignore, when a new component (say a title-window popup) is opening (even if the focus should be on the pop-up window, the focus ticks in the blured background.)
      I`ve tried something like:
      dispatchEvent(new KeyboardEvent(KeyboardEvent.KEY_UP, true, false,9)) to simulate an ordinary tab-Hit on the stage, but the application ignores it.
      Meanwhile i`m planning to try the automation classes, but it seems that you need QTP to use them succesfully and i can`t imagine that it is so complicated to fire off a simple keyboard-hit and make the application react to it, as if some key was pressed on the real keyboard.
      The background of this all : I`m programming a game environment for disabled children, which can only use the simplest UI: one button, so all the components must be parsed automatically and listen to one key-stroke. A Little tip from the experts concerning this keyboard-automation would be very helpful;-) The documentation for Focusmanagers is a little poor.