Propagation of the event

Good day everyone,

I had a question about the propagation of the event.

My situation is as follows; I had an Application.mxml with 2 child components, let's say Comp1.mxml and Comp2.mxml.

I send a custom in Comp2.mxml event I want to deal with in Comp1.mxml.

How can I directly listen for an event of Comp2 in Comp1 without having to bubble it to the application root first?

I thought that the useCapture could help me with this, but I can't seem to make it work.

What I have now is:

COMP2. MXML-> dispatchEvent with bubbles set to true

|

Application.MXML-> addEventListener (event, comp1.eventHandler)

|

COMP1. MXML-> function public eventHandler() {}

The above works fine, but I don't like the fact that I have listen for the event in Application while Comp1 is the only component that must be faced.

Is it possible to just listen for the event of Comp2 directly in Comp1?

Thanks in advance!

Hello Oracle,

You can register and ship w.r.t. systemManager events when you want to listen to events in components/objects that do not participate

propagation of the event...

So send the event in your comp2 as systemManager.dispatchEvent (YourEvent);  and in your Comp1 listen it w.r.t. systemManager...

systemManager.addEventListener (YourEvent, eventHandler);

It should work fine for you.

Thank you

Jean Claude

Tags: Flex

Similar Questions

  • How to reach all children during the use of Propagation of the event?

    Hello

    I use the Propagation of the event in order to change the alpha of each child on MOUSE_OVER and MOUSE_OUT MOUSE_DOWN to help...

    evt. Target.Alpha

    More alpha of the child increases of 0-0.5.

    On OUT it is 0.5-0.

    On down, he goes to 0.5 and stays there even with a MOUSE_OUT.

    I want to do then is add a button to the main stage, that reduces the visibility of all children to 0, a base type of the clear button.

    I have a way to do where I list each child in a function (all 9!). But I can re - write this so that all children are required to write code so much?

    Ideally, I would like to send a request to find the number of children (9), then use this variable to write a function that says (where n is the name of the Instance of each child) than n(0-numChildren).alpha = 0

    Here is my code - very - long breath:

    clearBtn.addEventListener (MouseEvent.CLICK, ContainerAlpaReset, false, 0, true);

    musicContainer.addEventListener (MouseEvent.MOUSE_OVER, onMusicOver, false, 0, true);

    musicContainer.addEventListener (MouseEvent.MOUSE_OUT, onMusicOut, false, 0, true);

    musicContainer.addEventListener (MouseEvent.MOUSE_DOWN, onMusicClick, false, 0, true);

    var i: Number = 0.5

    function onMusicOver(evt:MouseEvent):void {}

    if (evt.target.alpha == 0)

    evt.target.alpha = 0.5;

    }

    function onMusicOut(evt:MouseEvent):void {}

    if (evt.target.alpha == I)

    evt.target.alpha = 0;

    else (evt.target.alpha = 1);

    }

    function onMusicClick(evt:MouseEvent):void {}

    evt.target.alpha = i + 0.5;

    }

    function ContainerAlpaReset(evt:MouseEvent):void {}

    musicContainer.n1.alpha = 0;

    musicContainer.n2.alpha = 0;

    musicContainer.n3.alpha = 0;

    musicContainer.n4.alpha = 0;

    musicContainer.n5.alpha = 0;

    musicContainer.n6.alpha = 0;

    musicContainer.n7.alpha = 0;

    musicContainer.n8.alpha = 0;

    musicContainer.n9.alpha = 0;

    removeEventListener (MouseEvent.CLICK, ContainerAlpaReset);

    }

    Is there a simple way to write the part in bold? That is to say:

    musicContainer. Children? .alpha = 0;?

    Or better yet, can I use numChildren count and then write a generic piece of code that adds each count to the n #?

    Thank you for all the answers!

    Try

    function ContainerAlpaReset(evt:MouseEvent):void {}

    for (var i: uint = 1; i<10;>

    musicContainer ["n" + String (i)] .alpha = 0;

    }

    removeEventListener (MouseEvent.CLICK, ContainerAlpaReset);

    }

  • Missing button for the Propagation of the event in the Script Editor

    Hello

    Anyone who is missing the button to activate the event bubbling in the script editor?

    I know that it was there once, but seems to be gone since I installed SP2 (9.0.0.2.20101008.2.720808) for Designer.

    It only becomes active when you click a subform that has child nodes. So if you add a script that changes the bordercolor on the input of a subform event, this box has become active and allows you to spread the order for all objects contained in the subform.

    Note that she was abducted for SP2 because it caused too much confusion for users. Advanced users who use these facilities must make the changes in the xml source as the provided button.

    Paul

  • Double-click on the propagation of the event

    I have a couple of Sprites on my screen and I want to write a single event handler to handle the double click on any one of these Sprites. The following approach works for every type of event except DOUBLE_CLICK:

    package {
         import flash.display.Sprite;
         import flash.events.MouseEvent;
    
         public class Main extends Sprite
         {
              public function Main()  {
    
                   var circle1:Sprite = new Sprite();
                   var circle2:Sprite = new Sprite();
                   
                   circle1.graphics.lineStyle(1, 0xFF0000);
                   circle1.graphics.beginFill(0xFFFFFF);
                   circle1.graphics.drawCircle(0, 0, 10);
                   circle1.graphics.endFill();
                   
                   circle2.graphics.lineStyle(1, 0xFF0000);
                   circle2.graphics.beginFill(0x000000);
                   circle2.graphics.drawCircle(0, 0, 10);
                   circle2.graphics.endFill();
                   
                   circle1.x = 30; circle2.x = 60;
                   circle1.y = 30; circle2.y = 30;
                   
                   this.addChild(circle1);
                   this.addChild(circle2);
                   
                   this.mouseChildren = false;
                   this.doubleClickEnabled = true;
                   this.addEventListener(MouseEvent.DOUBLE_CLICK, onDoubleClick);
              }
              
              private function onDoubleClick(e:MouseEvent):void {
                   trace("DOUBLE_CLICK event fired");
                            // e.target.scaleX = 2; e.target.scaleY = 2;
              }
         }
    }
    

    I don't want to change this:

    this.mouseChildren = false;
    this.doubleClickEnabled = true;
    this.addEventListener(MouseEvent.DOUBLE_CLICK, onDoubleClick);
    

    to do this:

    circle1.mouseChildren = false;
    circle1.doubleClickEnabled = true;
    circle1.addEventListener(MouseEvent.DOUBLE_CLICK, onDoubleClick);
    
    
    circle2.mouseChildren = false;
    circle2.doubleClickEnabled = true;
    circle2.addEventListener(MouseEvent.DOUBLE_CLICK, onDoubleClick);
    
    

    To make it work, because in my application, I get a lot of Sprites. In my opinion, a unique event and the target property are better than hundreds of event listeners. Am wrong me or must add event listeners to each Sprite?

    var circle1:Sprite = new Sprite();
    var circle2:Sprite = new Sprite();

    Circle1.Graphics.LineStyle (1, 0xFF0000);
    Circle1.Graphics.beginFill (0xFFFFFF);
    Circle1.Graphics.drawCircle (0, 0, 10);
    Circle1.Graphics.endFill ();

    Circle2.Graphics.LineStyle (1, 0xFF0000);
    Circle2.Graphics.beginFill (0x000000);
    Circle2.Graphics.drawCircle (0, 0, 10);
    Circle2.Graphics.endFill ();

    Circle1.x = 30;
    Circle2.x = 60;
    Circle1.y = 30;
    Circle2.y = 30;

    this.addChild (circle1);
    this.addChild (circle2);

    stage.doubleClickEnabled = true;
    stage.mouseChildren = true;
    for (var i: uint = 0; i
    {
    Try
    {
    Sprite (this.getChildAt (i)) .doubleClickEnabled = true;
    }
    catch (error)
    {
    }

    }

    stage.addEventListener (MouseEvent.DOUBLE_CLICK, onDoubleClick);

    function onDoubleClick(e:MouseEvent):void
    {
    Try
    {
    e.target.scaleX = 2;
    e.target.scaleY = 2;
    }
    catch (error)
    {

    }
    }

  • Propagation of the event in AS3/Flex 3.3

    How sub - app event appears loaded into the application domain main child application?

    In other words the main application load under app in the child application domain.  Sub - app dispatches event

    who is supposed to be listened to in the main application. How to do?

    Kind regards

    _Ilya

    Once the app is on the display list (after applicationComplete) bubbles

    should work.

  • Timers and Propagation of the event

    Hello

    I'm having a bit of trouble finding it, any help would be appreciated. I have a container named circleHolder_mc. inside I have four circles named circ0_mc circ4_mc. My goal is that each circle flashing on mouseover. The closest I've got is the following code that causes all the circles to blink at the same time.

    circleHolder_mc.addEventListener (MouseEvent.MOUSE_OVER, onBlink)
    circleHolder_mc.addEventListener (MouseEvent.MOUSE_OUT, unBlink)


    var: timer = new Timer (1);
    timer.addEventListener (TimerEvent.TIMER, onTimer);


    function onTimer(evt:TimerEvent):void {}
    Alpha += 7;
    }

    function onBlink(evt:MouseEvent):void {}
    Timer.Start ();
    }

    function unBlink(evt:MouseEvent):void {}
    Timer.Stop ();
    Alpha = 100;
    }

    Any thoughts?

    Thank you

    -Sean

    then use:

    var tl:MovieClip =;

    for (var i: uint = 0; i<>

    circleHolder_mc ["circ" + i.toString () + "_mc"] .addEventListener (MouseEvent.MOUSE_OVER, startblinkF)

    circleHolder_mc ["circ" + i.toString () + "_mc"] .alpha is. 4;

    }

    function endblinkF(mc:MovieClip):void {}
    MC.alpha = 4.
    }
       
    function startblinkF(evt:MouseEvent):void {}
    evt.currentTarget.alpha = 1;

    clearTimeout() (evt.currentTarget.endblinkTO);

    evt.currentTarget.endlblinkTO = setTimeout(endblinkF,500,evt.currentTarget);

    }

  • Mobile IconItemRenderer - prevent the spread of the events

    Hello

    I don't want anything to be taken when an item is clicked or touched in a mobile itemRenderer that extends from IconItemRenderer.

    The drawBackground method override Isteand and do not to listen to the event of change, is anyway to do it faster, as preventing the propagation of the event?

    Thank you.

    You should be able to set mouseEnabled/mouseChildren false on the rendering engine, or call preventDefault() on the mouseDown event.

  • Prevent the default behavior of the events

    How can I prevent the default behavior of the events?

    I know that this concept of JavaScript or ActionScript where you can prevent the default behavior of an event by calling e.preventDefault ().

    How can I achieve this in JavaFX?

    For example, I have a KeyEvent on a TextArea and want to intercept the Enter key and stop him to position the cursor in the new line.

    I tried consume(), but apparently, it's the equivalent of e.stopPropagation ().

    TextArea has a bug on the management of mouse events: http://javafx-jira.kenai.com/browse/RT-17902, whereby scrollpane transmitting text editable eating events and if the events are not exposed to users of the API, do not know if this will have an effect as the key to transformation of the text box you want to perform. If the question in 17902 is at the origin of the text box does not correctly answer the treatment of key events defined by the user, you can add an additional comment to this Jira to see.

    Information on the management of events can be found here: Re: event bubbling smile of understanding

    If the TextArea event management worked properly, you should probably be able to do what you want by adding an EventFilter on the text box and consuming of the event you want to capture. Do this in an EventFilter so you can intercept the event in the capture phase is best to try to do it in an EventHandler for the propagation phase. If try to consume the event in an EventHandler, it may not work because the event may already have been handled by the target node or the children of the node target.

  • substitute the target of the event

    Hi, I'm doing a simple table

    on mouse down, start drawing

    moving the mouse, if the drawing, draw the line

    on the mouse upward, stop drawing

    I put the headphones on a single clip with a rectangle. If I do not fill the rectangle, mouse events do not fall within the rectangle, but if I fill the rectangle, it will paint behind the rectangle, anyway I will not see any results succesfull.

    what I did was to create another sprite and paint it. something like

    rectangle.addEventListener (draw_in_sprite, etc.)

    Manager: function draw_in_sprite (etc) {}

    etc.

    other_sprite_above_rectangle. Graphics.Draw the following mouse() line

    etc.

    }

    I can't paint a long line, because once he finished the 'move' event, the focus seems to be on canvas sprite even though that I did not define top headphones

    I also try to move some other sprite based on the events of the mouse on the stage, but when the movement of the sprite he puts under the mouse pointer, the scene is not the target of the event more

    I read the documentation and he talks about cause 'propagation', I tried to put "Event.stopPropogation" in the script but I have seen no effect work and there is no examples and explanation doesn't say much. How can I say to cancel the event management on the sprites that are superior to others?

    TNX

    If you were to draw the rectangle through actionscript, you can then use the graphics class to draw the background 'upstairs'.  now, I'm also assuming that you are referring to a "custom cursor" as "another sprite" you want to move when drawing.  so if you do a little more of this via actionscript, you can resolve some of these issues.  throw the code below on the first picture of new doc and test

    Mouse.Hide ();

    var paint: Boolean = false;

    var chalk: Sprite = new Sprite();
    chalk.graphics.lineStyle (8, 0xFFFFFF);
    chalk.graphics.moveTo (0,0);
    chalk.graphics.lineTo (15, -15);
    chalk.mouseEnabled = false;
    addChild (chalk);

    var box: Sprite = new Sprite();
    box.graphics.beginFill (0x000000);
    box.graphics.drawRect (0,0,stage.stageWidth, stage.stageHeight);
    box.graphics.endFill ();
    addChildAt (box, 0);

    box.addEventListener (MouseEvent.MOUSE_DOWN, startPaint);
    box.addEventListener (MouseEvent.MOUSE_UP, stopPaint);
    box.addEventListener (MouseEvent.MOUSE_MOVE, moveChalk);

    function moveChalk(e:MouseEvent):void {}
    If (Paint) e.target.graphics.lineTo (mouseX, mouseY);
    Chalk.x = mouseX;
    Chalk.y = mouseY;
    e.updateAfterEvent ();
    }

    function startPaint(e:MouseEvent):void {}
    box.graphics.lineStyle (4, 0xFFFFFF);
    box.graphics.moveTo (mouseX, mouseY);
    Paint = true;
    }

    function stopPaint(e:MouseEvent):void {}
    Paint = false;
    }

  • the iOS 10 not displaying calendar widget is not the events

    After the update to iOS 10.0.2, the calendar available on the lock screen widget does not always display the events. Nor the duration of the event or the event name appears, but a white widget with calendar color bar can be seen.

    This is not always the case, but very often. For ex, if you open the calendar application, then check this widget, event, but after that you lock the screen and check again, it would disappear.

    Hello jyothishureth,

    Thank you for using communities of Apple Support. It is my understanding from your iPhone Calendar widget still shows no events. I use my daily calendar to keep me organized. I can understand your concern. I'm happy to help you.

    If you haven't done so already, I recommend that you restart the phone. This can solve many unexpected behaviours. Follow the steps below:

    1. Press and hold the sleep/wake button until the Red slider appears.
    2. Drag the slider to turn off your device completely off.
    3. Once the device turns off, press and hold the sleep/wake button again until you see the Apple logo

    Restart your iPhone, iPad or iPod touch

    If the problem persists, try to remove the widget and adding it back on. Use the following steps:

    1. Right above the home, lock screen or Notification Centerscreen.
    2. Scroll down and tap on change.
    3. To add a Widget, press on . To remove a Widget, press on . To reorder your Widgets, touch and hold next to the apps and drag the in the desired order.
    4. Finally, tap done.

    Use Widgets on your iPhone, iPad and iPod touch

    Have a great day!

  • not all the events of the day on the notification screen

    Hello

    I can't get all the events of the day in the calendar widget on the screen of the notification of my iPad. Genius Bar and Apple Support are unable to solve. Can anyone help?

    Thank you

    for this I think should download sparse, ultra calendar application very simple, advanced and simplified

  • I can't save the events to the calendar

    I have some problems with my 5 c with ios 9.3.5 iphones. The first is the calendar application. When I try to record an event, after you complete all the content and select Add, the event does not appear on my calendar. The second problem is with the backup. The phone never complete the backup process.

    The last problem was with the screen. Constantly, I have to restart my phone because the screen looks like that the images do not match the screen. I can't unlock the screen and do nothing. I try to take a screenshot to it attached to this message, but the image seems normal.

    Please can someone tell me what I need to do?

    Since you've already tried resets, try a restore.

    Reset: hold the Home and Power buttons until you see the logo Apple (10-15 seconds).

    Restore your iDevice: https://support.apple.com/en-us/HT204184

    If your backup is in iTunes, make sure that it is encrypted.

    The latest issue can be a wandering selection in settings > general > accessibility > Zoom.

  • My calendar retains the events for a month, but when I look back over the past months, only recurring and default events are preserved.  I have a bad memory and I want that all events held on my calendar.  How can I do this?

    My calendar keeps events a month, but when I think back several months, only recurring and default events are preserved.  I have a bad memory and want to keep all the events, I put on my calendar for a year.  How can I do this?

    Go to settings > Mail, content, timing and you should see an option for synchronization. Make sure that you put in all the events if you want to keep past events calendar

    Alternatively you can also use iCloud.com to restore calendar events that may have been accidentally deleted

    If you've accidentally deleted your calendars, reminders, or contacts of...

    I hope this helps!

  • Whenever I sync my calendar on Lightning, I get a message "accept changes and update in any case" on several occasions, even though the event is deleted from the server

    This repetition of message every time I sync, therefore can freeze the Thunderbird application after 3-4 syncs

    Right-click recycle the message to the next synchronization
    Left button instantly recycle the message

    Event deleted on the server, lightning and by Organizer

    Disable Google provider problem ceases, but which makes unnecessary lightning

    TBird reinstalled, updated all modules

    Tried to download the image, but no luck...

    I deleted the event to my calendar and was the Organizer to do the same thing.

    What Organizer?

    I have the latest updates from each of the three

    Once again, what are your versions of Thunderbird, Lightning and the provider add-on?

    and charging each of them...

    I mean you don't have to reinstall Thunderbird, then it was a waste of time.

    You can try to remove the calendar in lightning, restart Thunderbird, and then recreate the calendar.
    Given that the calendar is a calendar of network no data will be lost.

    That said, it is always recommended to have a recent backup of profile.
    _ http://KB.mozillazine.org/Thunderbird: _FAQs_:_Backing_Up_and_Restoring

  • print a list of the events of the calendar 'find '.

    I have a no regular periodic event and have used the Find command to create a list of dates, but am unable to print this list in order to send it to someone else. When I use 'Select all"'copy' and 'Paste' to another document, I get the underlying code, not the data

    You really want to print on paper?

    If you save what you copy into a text file and give it an .ics extension, many other programs of the calendar will be able to open and see.

    However, try to select the events that you want to print (in the find pane), then go to file. Print and choose "Selected events". It seems to be trying to print what I selected. It prints well in PDF format; I don't have against a real hardware printer tried yet.

Maybe you are looking for