Return to table of contents
In ApplicationUI.mxml (init()), you will find the following two lines:
// in ApplicationUI.mxml, in init() titleControls.addEventListener( "showHelp", showHelpScreen ); addEventListener( "close", closePanel );
This is a little bit strange. One uses titleControls as event listener, the other uses ApplicationUI. It turns out this is due to the bubbling of event.
// in TitleControls.mxml <mx:Button click="dispatchEvent( new Event('showHelp') )" />
// in EmployeeView.mxml <mx:Button id="closeBtn" click="dispatchEvent( new Event( Event.CLOSE, true ) )"/>
Note that the “true” argument in the second case. It allows the Event to bubble to the parent components (ApplicationUI). That’s why ApplicationUI can hear the event. If you add “true” argument in the TitleControls.mxml, you can also use ApplicationUI to listen to the event.