This type of issue used to get me all the time with the classic Flex SDK. I'd have some subclass of Panel or something, but I'd have some kind of selectedItem property on it that dispatched Event.CHANGE. If I had a child that was a Slider or something, the slider's Event.CHANGE would bubble, and I'd have something higher up in the display list thinking that my Panel subclass' selectedItem was changing when it wasn't.
Most of the time, that's not an issue, but every once in a while, I'd see an event listener getting called way too often. If you aren't expecting that, there can be weird side effects. Performance is obviously a concern, but also, if your listener triggers some change to the UI, that could happen at times when it doesn't make any sense, and it's not necessarily immediately clear why. (Just thought I'd put a real world story behind why it's good for FlexJS to avoid bubbling in custom events) - Josh On Fri, Jul 21, 2017 at 7:25 AM, Alex Harui <aha...@adobe.com.invalid> wrote: > I think we can use setParentTarget to get bubbling to work reliably with > custom events, but as Peter said, I don't think we want to set up > parentTarget's just-in-case. Bubbling custom events is not a recommended > practice as was mentioned in some other thread recently. > > Imagine if you had a Panel as a child of a larger Panel. Bubbling a close > event from the inner Panel could easily cause the outer Panel's close > handler to also fire. > > My 2 cents, > -Alex > > On 7/21/17, 6:22 AM, "Peter Ent" <p...@adobe.com.INVALID> wrote: > > >I needed events to bubble for the drag and drop work. While that was fine > >for the Flash Player, the FlexJS/Google/Browser event mix didn't work. > >Alex suggested I used setParentTarget on the event to work up the tree and > >then the event would be dispatched at each level, thus mimicking bubbling. > >I did this exclusively for drag events (see DragEvent class). > > > >Rather than putting that in as the solution for this, I took a simpler > >approach. > > > >‹peter > > > >On 7/21/17, 2:35 AM, "Harbs" <harbs.li...@gmail.com> wrote: > > > >>Bubbling does not work very well in FlexJS in general. > >> > >>When you can rely on native browser event bubbling, it usually works > >>okay, but custom events don¹t bubble. > >> > >>> On Jul 21, 2017, at 1:49 AM, Justin Mclean <jus...@classsoftware.com> > >>>wrote: > >>> > >>> Hi, > >>> > >>>> The issue was that the TitleBar was dispatching "close" with > >>>>bubbles=true. > >>>> This works fine on SWF but not on the HTML platform without some extra > >>>> work. So I just had PanelView intercept the event and dispatch one > >>>>from > >>>> its strand. > >>> > >>> Out of interest is this because of a missing cloneEvent method or that > >>>it wasn¹t listening on a parent of the item that dispatched the bubbling > >>>event or something else? > >>> > >>> Thanks, > >>> Justin > >> > > > >