Learning Employee Directory 5.1 Event bubble

24 sec read

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.


Want to receive new post notification? 有新文章通知我

How much money did I make from an app?

Undoubtedly some people are very successful in making money by developing a smartphone app. Back in 2012 I developed an app called “Handbook of Brain” which is a collected resources of brain anatomy, function and diseases. I put the app i
Xu Cui
27 sec read

Handy programs to visualize NIRS data (2): plotTopoMap

Often you need to view the spatial pattern of activation as in the example below. plotTopoMap allows you to do that. It probably only works for Hitachi devices where the spatial relationship between channels are known. In the above example, the activ
Xu Cui
37 sec read

Flash 3D video demo

Racer Ostrova Zombie
Xu Cui
0 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *