2 Replies Latest reply on Aug 26, 2008 7:55 AM by Jimmy_Jeeves

    Stopping an event propagation

    Jimmy_Jeeves
      Hi!

      I want to provide hotkey in my html webpage. (I am using http://code.google.com/p/js-hotkeys/)
      I also have a chat module in Flex. When I am typing some text in the flash object, I don't want the hotkeys to be enabled.

      I tried to stop the propagation from the flash but it's not working.

      From what I know, the html events are propagated from the child to the parents. So if I stop the event from my flash object it has to be ok, right?

      See my example. If I display an Alert from the callback, it is displayed, so it works. Why the event is still propagated?

      Thanks
        • 1. Re: Stopping an event propagation
          Level 7

          "Jimmy Jeeves" <webforumsuser@macromedia.com> wrote in message
          news:g8va3c$ak4$1@forums.macromedia.com...
          > Hi!
          >
          > I want to provide hotkey in my html webpage. (I am using
          > http://code.google.com/p/js-hotkeys/)
          > I also have a chat module in Flex. When I am typing some text in the flash
          > object, I don't want the hotkeys to be enabled.
          >
          > I tried to stop the propagation from the flash but it's not working.
          >
          > From what I know, the html events are propagated from the child to the
          > parents. So if I stop the event from my flash object it has to be ok,
          > right?
          >
          > See my example. If I display an Alert from the callback, it is displayed,
          > so
          > it works. Why the event is still propagated?
          >
          > Thanks
          >
          > public function reportKeyDown(event:KeyboardEvent):void {
          > event.preventDefault();
          > event.stopPropagation();
          > }
          >
          > this.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
          >

          I don't think you can preventDefault on key events. You could probably use
          ExternalInterface to tell the web page not to listen for the hot keys for a
          while, though.

          HTH;

          Amy


          • 2. Re: Stopping an event propagation
            Jimmy_Jeeves Level 1
            Ok, I'll find another way to do that.
            Thanks