1. capture phase: flowing from base application to target
2. target phase
3. bubble phase: flow from target to base (reverse of 1)
This design enables using event listeners on any node in the flow. Was not there before Flex2. Due to this an even in the child can be heard by parent. All instances of the Event class have a bubbles property which indicates if event object will participate in bubbling phase. By default false for newly built events; Event class takes it as a second optional parameter set to false by default. Default true for some built in events like click.
You do not need to handle a bubbling event in between but you need to have it declared in the metadata so that the parent component may be able to hear it.
Remember that only custom events need to be enumerated explicitly with a metadata tag. But if they are of base Event type, we can simply mention them after import statements but before class declaration using [Event(name="someEvent")] metadata tag.
Questions:
- Explain event bubbling in flex.
- What are the advantages of event bubbling?
- How do we know if an event object will participate in the bubbling phase?
- Explain event flow in flex.
No comments:
Post a Comment