Event Propagation again. Sorry

Hi guys, I vave a pretty simple app to test how the propagation works.I do not undestand, why the propagation on the stage 3 (bubbling) works in the oppsit way than it should work.
Here is my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
            xmlns:view="view.*" initialize="init()">
<mx:Script>
<![CDATA[
     import mx.controls.Label;
     import mx.events.FlexEvent;
     import mx.controls.Button;
     import mx.controls.Alert;
     import flash.events.TextEvent;
     private function init():void {
          this.addEventListener(MouseEvent.CLICK, handleTestEvent);
          vBox2.addEventListener(MouseEvent.CLICK, handleTestEvent2);
          vBox1.addEventListener(MouseEvent.CLICK, handleTestEvent1);
     private function handleTestEvent2(event:MouseEvent):void {
          Alert.show("This is VBox2  " + event.eventPhase );
     private function handleTestEvent1(event:MouseEvent):void {
          Alert.show("This is VBox1  " + event.eventPhase);
     private function handleTestEvent(event:MouseEvent):void {
          Alert.show("This is Application  " + event.eventPhase);
]]>
     </mx:Script>
          <mx:VBox id="vBox2">
               <mx:VBox id="vBox1">
                    <mx:Button id="testButton" label="Click Me" />
               </mx:VBox>
          </mx:VBox>
     </mx:Application>
So, when I run this application, the first popup I see is: This is Application 3. Then: This is VBox2 3  and the last one: This is VBox1 3. But as I understud the order should be: This is VBox1 3,  This is VBox2 3,  This is Application 3.
Could some body explain what's wrong?
Thanks.

The Alert boxes sit on the top of the display.
When you get the first alert, it appears over the content.
When the second happens it sits over the first alert.
Then the third happens and sits over the second.
So, when you see the third alert, it looks like there is only one box, but there are two underneath - hidden.
You dismiss the third alert and see the second.
You dismiss the second and see the first.
It looks like the order is reversed, but in fact the order is correct and they have just popped up over each other. It feels that dismissing the third alert causes the second alert to popup, but it doesn't - it was there all along.
Alert isn't synchronous.

Similar Messages

  • Stopping Event Propagation

    Hi All,
    Am facing some issue in event propagation.
    I have a Application component with in which I have a link button. The Application has a mouseDown event listening for it and the link button has the click event listening for it.
    I have a requirement where in if i click on the link button i got to show an image and on again clicking on the link button hiding the image. Basically toggling the hide/show of image on click of the link button. This works fine as expected.
    Now I have mouseDown listening on the Application, where in If I click any where else in the Application again the Image show be hidden and only on click of Link button it should be shown.
    But since I have the mouseDown listening on the Application, whenever I click on the Link button the image is showing properly but then after that when I click the link button again to hide the image, then since two events are getting triggered  the Image is never getting hidden. It always shows up.
    THE FIX I NEED is that when i click on the link button, the parent event should be stopped from bubbling and hence only the Link Button's Click should be called and not the Application's mouseDown.. And in else other places, its fine to have the Application's mouseDown event called.
    I Tried event.stopPropagation () and event.stopImme()...but in vain.......... PLS HELP

    "Jimmy Jeeves" <[email protected]> wrote in
    message
    news:g8va3c$ak4$[email protected]..
    > 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

  • Event propagation

    Hi,
    SAP has standard functionality of event propagation from FU to FB and vice versa.Now if I want to stop event propagation or event cascading functionality from FB to FU do I need to remove any code logic check in the extractor? Can you elaborate in details here.
    Secondly how does preprocessing functionality help in ENM functionality. What specific checks can eb brought about if w ewant to implement this functionality

    Hi Dipak,
    Extract the FU number as TOR_TEC tracking id from TM shown below
    FU EH TRacking ID table
    Tr.Code.Set
    Tracking id
    FU
    123456
    TRQ
    987563
    TO
    458796
    TOR_TEC
    123456
    Define the Tracking id Code Set(TOR_TEC) in Event reporting items under event message profile , configure only to particular internal event code which does not requires event propagation to FB.
    Above configuration supported only when the event posted via EM WebUI,
    you have to apply the same logic in BADI for interface event posting.
    Regards
    Sukumar

  • [svn:fx-trunk] 9215: Event Propagation bug fix

    Revision: 9215
    Author:   [email protected]
    Date:     2009-08-10 17:30:21 -0700 (Mon, 10 Aug 2009)
    Log Message:
    Event Propagation bug fix
    http://bugs.adobe.com/jira/browse/SDK-21044 - Spark Components should use event.preventDefault instead of event.stopPropagation
    Since keyboard are now cancellable, the Spark components should use event.preventDefault() / event.isDefaultPrevented()  instead of event.stopPropagation. I updated ButtonBar, RadioButton, and DropDownList to use preventDefault(). Also cleaned up Slider and Spinner to always assume the event is cancellable.
    QE notes: Add tests with these components inside of scrollable containers
    Doc notes: None
    Bugs: SDK-21044
    Reviewer: Hans
    Tests run: Slider, Spinner, RadioButton, ButtonBar, DropDownList
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-21044
        http://bugs.adobe.com/jira/browse/SDK-21044
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBar.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RadioButton.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Spinner.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/DropDownCont roller.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as

    error dateField not selecion date 27/11/2002 ?
    This is bug flex 3 ?
    thanks

  • Event propagation API

    Hi,
    I recently started using Flex and read through the, very extensive and well written documentation. I read about the event propagation mechanism and was rather stunned that only Objects that have a parent-child relationship take part in event propagation. At first I couldn't believe it but trying to connect to objects that were at very different parts of the display list showed, that the events really do not get delivered! Wouldn't it be better to have a more general mechanism that does not care about the wherabouts of the components? I mean, what if I want to synchronize some model objects that are not even part of the display list with some UI Element they have a relationship with? The target phase doesn't work because its not the model that throws the event (of course!). Or do I miss something here?
    I was expecting a more subject-observer like pattern,  that allows me to connect whatever I want with whatever there is left. So, how do I do that. Do I have to right my own little event dispatching library (what would not be so difficult, but I would rather use something that has already proven its liability)? Can anybody recommend me a good API for that or tell me that I am dead wrong and missing something important?
    Regards,
    Benni

    Only DisplayObjects support bubble and capture propagation.  In a tree of
    regular Objects, as long as you attach a listener to the right object, you
    will be able to get its events.
    Bubble and capture are very dangerous as they break encapsulation.  We only
    use them for situations where the target is unpredictable like in mouse and
    keyboard interaction.  I would probably not use it in a data object tree.
    Maybe if you provide a more explicit example of what you are trying to
    accomplish and what you tried, folks on the forum can help.

  • IPhoto changed the order of my events. Again

    Hello everyone!
    Two days ago, I opened iPhoto and it said that there have been some mistakes with the application so I had to fix. I did it and when it finished, I saw that my events were changed and photos that I had deleted were there again.
    How do I fix this? I have a lot of different events and it really gets me upset to organize them again.
    Thanks in advance

    Sounds like you have a corrupted database.
    Surefire solution: restore from your back up.
    Otherwise:
    Download iPhoto Library Manager and use its rebuild function. (In Library Manager it's the FIle -> Rebuild command)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  

  • Mobile IconItemRenderer - prevent event propagation

    Hello,
    I don't want anything to happen when an element is clicked or touched in a mobile itemRenderer extending IconItemRenderer.
    Isteand of overriding the drawBackground method and not listening for the change event, is there anyway of doing this faster, like preventing the event from propagating?
    Thank you.

    1. commitProperties seems fine
    2. I assume it would be faster since you avoid unnecessary drawBackground calls.  You might want to test to make sure.
    3. Correct, if you can't click on something it won't be able to fire a mouseDown event
    4. The mouseDown listener is added to the renderer in List.dataGroup_rendererAddHandler.  You could tweak it there, but that would require a subclass of List.  I typically find it easier to do from within the renderer via one of the two approaches I mentioned above especially when that changes based on the data in the renderer.
    5. The Flex SDK currently deals exclusively with mouse events.  See the "Mouse vs. Touch Events" section of this spec for more information: http://opensource.adobe.com/wiki/display/flexsdk/Mobile+List%2C+Scroller+and+Touch

  • Event propagation in mediumweight components

    Hi,
    There's an article "Mixing heavy and light components":
    http://java.sun.com/products/jfc/tsc/articles/mixing/
    It explains mouse event handling:
    "Mouse events on a lightweight component fall through to its parent; mouse events on a heavyweight component do not fall through to its parent. "
    What about mediumweight components? Are mediumweight components receiving mouse events like lightweight or like heavyweight components?
    Is it possible to infer how the mouse events are propagated just by using JComponent.isLightweightComponent()?
    Kari

    What do you mean by sub-app .  Are you using modules ?  For regular situations you can set "bubbles" to true on the event.

  • Help with understanding key event propagation

    Hello,
    I am hoping someone can help me understand a few things which are not clear to me with respect to handling of key events by Swing components. My understanding is summarized as:
    (1) Components have 3 input maps which map keys to actions
    one for when they are the focused component
    one for when they are an ancestor of the focused component
    one for when they are in the same window as the focused component
    (2) Components have a single action map which contains actions to be fired by key events
    (3) Key events go to the currently focused component
    (4) Key events are consumed by the first matching action that is found
    (5) Key events are sent up the containment hierarchy up to the window (in which case components with a matching mapping in the WHEN_IN_FOCUSED_WINDOW map are searched for)
    (6) The first matching action handles the event which does not propagate further
    I have a test class (source below) and I obtained the following console output:
    Printing keyboard map for Cancel button
    Level 0
    Key: pressed C
    Key: released SPACE
    Key: pressed SPACE
    Level 1
    Key: pressed SPACE
    Key: released SPACE
    Printing keyboard map for Save button
    Level 0
    Key: pressed SPACE
    Key: released SPACE
    Level 1
    Key: pressed SPACE
    Key: released SPACE
    Printing keyboard map for Main panel
    Event: cancel // typed SPACE with Cancel button having focus
    Event: save // typed SPACE with Save button having focus
    Event: panel // typed 'C' with panel having focus
    Event: panel // typed 'C' with Cancel button having focus
    Event: panel // typed 'C' with Save button having focus
    I do not understand the following aspects of its behaviour (tested on MacOSX although I believe the behaviour is not platform dependent):
    (1) I assume that the actions are mapped to SPACE since the spacebar clicks the focused component but I don't explicitly set it?
    (2) assuming (1) is as I described why are there two mappings, one for key pressed and one for key released yet the 'C' key action only has a key pressed set?
    (3) assuming (1) and (2) are true then why don't I get the action fired twice when I typed the spacebar, once when I pressed SPACE and again when I released SPACE?
    (4) I read that adding a dummy action with the value "none" (i.e. the action is the string 'none') should hide the underlying mappings for the given key, 'C' the my example so why when I focus the Cancel button and press the 'C' key do I get a console message from the underlying panel action (the last but one line in the output)?
    Any help appreciated. The source is:
    import javax.swing.*;
    public class FocusTest extends JFrame {
         public FocusTest ()     {
              initComponents();
              setTitle ("FocusTest");
              setLocationRelativeTo (null);
              setSize(325, 160);
              setVisible (true);
         public static void main (String[] args) {
              new FocusTest();
    private void initComponents()
         JPanel panTop = new JPanel();
              panTop.setBackground (java.awt.Color.RED);
    JLabel lblBanner = new javax.swing.JLabel ("PROPERTY TABLE");
    lblBanner.setFont(new java.awt.Font ("Lucida Grande", 1, 14));
    lblBanner.setHorizontalAlignment (javax.swing.SwingConstants.CENTER);
              panTop.add (lblBanner);
              JPanel panMain = new JPanel ();
              JLabel lblKey = new JLabel ("Key:");
              lblKey.setFocusable (true);
              JLabel lblValue = new JLabel ("Value:");
    JTextField tfKey = new JTextField(20);
    JTextField tfValue = new JTextField(20);
    JButton btnCancel = new JButton (createAction("cancel"));     // Add a cancel action.
    JButton btnSave = new JButton (createAction("save"));          // Add a sve action.
              panMain.add (lblKey);
              panMain.add (tfKey);
              panMain.add (lblValue);
              panMain.add (tfValue);
              panMain.add (btnCancel);
              panMain.add (btnSave);
              add (panTop, java.awt.BorderLayout.NORTH);
              add (panMain, java.awt.BorderLayout.CENTER);
    setDefaultCloseOperation (javax.swing.WindowConstants.EXIT_ON_CLOSE);
    // Add an action to the panel for the C key.
              panMain.getInputMap (JComponent.WHEN_IN_FOCUSED_WINDOW).put (KeyStroke.getKeyStroke (java.awt.event.KeyEvent.VK_C, 0), "panel");
              panMain.getActionMap ().put ("panel", createAction("panel"));
              // FAILS ???
              // Add an empty action to the Cancel button to block the underlying panel C key action.
    btnCancel.getInputMap().put (KeyStroke.getKeyStroke (java.awt.event.KeyEvent.VK_C, 0), "none");
    // Print out the input map contents for the Cancel and Save buttons.
    System.out.println ("\nPrinting keyboard map for Cancel button");
    printInputMaps (btnCancel);
    System.out.println ("\nPrinting keyboard map for Save button");
    printInputMaps (btnSave);
              // FAILS NullPointer because the map contents are null ???
    System.out.println ("\nPrinting keyboard map for Main panel");
    // printInputMaps (panMain);
    private AbstractAction createAction (final String actionName) {
         return new AbstractAction (actionName) {
              public void actionPerformed (java.awt.event.ActionEvent evt) {
                   System.out.println ("Event: " + actionName);
    private void printInputMaps (JComponent comp) {
         InputMap map = comp.getInputMap();
         printInputMap (map, 0);
    private void printInputMap (InputMap map, int level) {
         System.out.println ("Level " + level);
         InputMap parent = map.getParent();
         Object[] keys = map.allKeys();
         for (Object key : keys) {
              if (key.equals (parent)) {
                   continue;
              System.out.println ("Key: " + key);
         if (parent != null) {
              level++;
              printInputMap (parent, level);
    Thanks,
    Tim Mowlem

    Use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the posted code retains its original formatting.
    1) In the Metal LAF the space bar activates the button. In the Windows LAF the Enter key is used to activate the button. Therefore these bindings are added by the LAF.
    2) The pressed binding paints the button in its pressed state. The released binding paint the button in its normal state. Thats why the LAF adds two bindings.
    In your case you only added a single binding.
    3) The ActionEvent is only fired when the key is released. Same as a mouse click. You can hold the mouse down as long as you want and the ActionEvent isn't generated until you release the mouse. In fact, if you move the mouse off of the button before releasing the button, the ActionEvent isn't even fired at all. The mouse pressed/released my be generated by the same component.
    4) Read (or reread) the [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html#howto]How to Remove Key Bindings section. "none" is only used to override the default action of a component, it does not prevent the key stroke from being passed on to its parent.

  • Stopping an event propagation

    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

    "Jimmy Jeeves" <[email protected]> wrote in
    message
    news:g8va3c$ak4$[email protected]..
    > 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

  • Event propagation and inheritance

    Hi,
    I have a button inheriting from another. In the ancester I have a CLICK event handler registered.I have another CLICK event handler in the descendent button. In the descendent I want to handle the CLICK event combined with the CTRL key. Without the CTRL key I want the the ancester event handler to do it's work. I tried different combinations of StopPropagation(), StopImmediatePropagation priorities, etc...with no satisfactory result. Sometimes both event handlers are triggered, sometimes only the event handler for the descendent is triggered. What would be the way to do this. Thanks in advance.

    Thanks Natasha,
    I solved my problem by overriding the click event handler in the descendent like:
    override protected function clickHandler(event:MouseEvent):void {
         if (event.ctrlKey) {
              ...do the stuff in case of CTRL-key held
         } else {
              // Do ancestor work for normal click         
              super.dispatchEvent(event)
    So...no need for stopping propagation of the event

  • How to configure which changes in the document triggers Event Handler again

    Hi Experts
    Due to some reason after creation of Purchase Order, the event handler is not created in EM system. Now is there any way to resend this PO to EM? For example, is it possible to trigger Event Handler by changing some field in PO? If it is possible that way, Could you guide how to configure which changes in the document (PO/SO/Delivery/Shipment) can trigger Event Handler in EM system?
    Thanks
    Ravi

    Hello Ravi,
    if you change the PO Header/Item the respective EH  should be created if the Relevance condition is fullfilled.
    I'm not sure if it also works in the case that you change the PO Header and EH for PO Items will be created.
    Best regards,
    Steffen

  • Cross dissolve problem again, sorry.

    I spoke too soon. Using the Command T key only rewards with an alert sound. No dissolve. This has to be operator error. I am placing the cursor on the transition point but cannot add a cross dissolve.
    Best.
    Tom

    Are you sure you have enough media to create the dissolve?  If you don't, you will get an audible error and you should see a pop-window with that warning (unless you selected "don't show again").
    Using the "Available Media" preference requires that you have enough head/tails on both the incoming and outgoing clips for the transition.  If you use the Overlap Media preference it will use whatever media is available to create the transition--hence the reason your timeline is shrunk.
    One possible work around is to go back to your preferences and set the default dissolve time to less than 1 second if all you need is a very quick dissolve.  This is just a hunch though, I haven't had a chance to try it.

  • Swing Mouse Event Propagation

    Hello,
    I'm developing my first Swing application.
    One of the components is a thumbnail image panel (ext. JPanel) containing several other components (mostly ext. JLabel). I have the image panel receiving mouse events so as to allow the user to see when the image panel is 'in focus' (rollover effect basically) and to allow the image panel to be selected by clicking.
    I added a tooltip to one of the contained labels, and it now 'consumes' my mouse enter/exit event so that now it is as if the label is not part of it's container. This is not what I want.
    Is there not some simple way to allow mouse events to be listened for by a child component but yet to 'fall through' to a listener in the parent component?
    Any insight into this little problem would be most appreciated.
    Thanks.

    You can listen to all MouseEvents generated:
    Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener()
         public void eventDispatched(AWTEvent e)
              System.out.println(e);
    }, AWTEvent.MOUSE_MOTION_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);You would then need to determine if the source component is a descendent of your main panel.

  • Event propagation in AS3/Flex 3.3

    How to bubble up event from sub-app loaded into child application domain to the main app?
    In other words main app loads sub app in child application domain.  Sub-app dispatches event
    which is supposed to be listened in the main app. How to do it?
    Regards,
    _Ilya

    What do you mean by sub-app .  Are you using modules ?  For regular situations you can set "bubbles" to true on the event.

Maybe you are looking for

  • Excise in Depot to Depot STO

    Hi Gurus, The process in Depot to Depot STO process. Say Depot A is importing a material and transferring to another Depot B. Depot B raised an PO and A sent the goods via outboun delivery along with the Excise inv generated thru J1IJ. Now when we do

  • How do i get music from my iPhone to my new macbook pro?

    my old laptop is broken and i got a new macbook pro. but now i can't put the songs from my iphone onto my macbook. how do i get my music onto iTunes

  • Alternative to Apple TV for composite video

    Like 80% of Americans, I don't have a high-definition TV. My TV only supports composite video input (a yellow RCA plug) or analog coaxial input. I had hoped to be able to use an Apple TV to watch video purchased from the iTS on my TV. It appears that

  • What keystrokes to move to end of document on an Mac Book Pro keyboard using Microsoft word?

    What keystrokes do I use to move to the end of document on an Mac Book Pro keyboard using Microsoft word? I've tried fn+option+ right arrow etc but doesn't do it. Cheers, Much appreciated. Schbang

  • Every 15 minutes, I loose my mouse and keyboard

    I have a very annoying problem.  Every 15 minutes or so, on my Switch 12, I loose my mouse and my keyboard.  Only the touch screen works.  I have to shutdown and restart to get them back until is stops again.  Any idea?