User Guide

112 Creating Advanced MXML Components
Handling events from composite components
Composite components are components that use a container for the root tag, and define child
components in that container. You handle events generated by the root container in the same
way as you handle events generated by simple MXML components. That is, you can handle
the event within the MXML component, within the referencing file, or both. For more
information, see “Handling events from simple MXML components” on page 107.
To handle an event that a child of the root container dispatches, you can handle it in the
MXML component in the same way as you handle an event from the root container.
However, if a child component of the root container dispatches an event, and you want that
event to be dispatched to the referencing file, you must add logic to your custom component
to propagate the event.
For example, you can define a component that uses an
<mx:Form> tag as the root tag, and
include within it a ComboBox control. Any event that the Form container dispatches, such a
scroll event, is dispatched to the referencing file of the custom component. However, the
close event of the ComboBox control is dispatched only within the custom MXML
component.