6 Replies Latest reply on Jul 24, 2011 7:54 PM by BobTheCoolGuy

    StopPropagation in Accordion Component Causing Trouble for Global Keyboard Shortcuts

    BobTheCoolGuy

      When an accordion component in my Flex (4.5) application has focus, its keyDownHandler method calls event.stopPropagation() of the KeyboardEvent, which prevents it from bubbling to my global listener attached to the stage.  I'd like it if there was an easy option to fix this, but there didn't seem to be, so I decided to extend Accordion and override its keyDownHandler.  For some reason, I couldn't find any good way to allow the keyDownHandler to process the event and allow it to bubble up.

       

      A friend eventually suggested a somewhat hackish solution (this from mysubclass of Accordion):

       

       

      override protected function keyDownHandler(e:KeyboardEvent):void
                {
                     setTimeout(keyDownDeferred, 1, e);
                }
      private function keyDownDeferred(e:KeyboardEvent):void
                {
                     super.keyDownHandler(e);
                }
      

      I was wondering if there is a cleaner/better way to do this.

       

      Thanks