O'Reilly logo

Professional Cairngorm™ by Jeremy Wischusen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

6.5. Summary

In this chapter you looked at the classes associated with Cairngorm events. These included:

  • CairngormEvent: Used to differentiate Cairngorm events from events raised by the underlying Flex framework (or similar)

  • CairngormEventDispatcher: A singleton class used by the application developer to broadcast events that correspond to user gestures and requests

Cairngorm events and Flex events are both based on the flash.events.Event class. The major difference is that Cairngorm events are self-dispatching and are designed to work with the FrontController class through the CairngormEventDispatcher.

You create a Cairngorm event by extending the com.adobe.cairngorm.control.CairngormEvent class. Depending on the example you are looking at, they may be created in different locations, including the business.events package (as in the FStop application from the "Flex 3: Introducing Cairngorm" article) or an events package (Cairngorm store).

The general naming convention is to prefix the word event with something descriptive about the logic that the event triggers (e.g., LoadItemsEvent).

If you are creating events using the one-to-one correspondence with commands, your event will have only one type, and you can modify the constructor to remove the type parameter and pass the super-constructor the type constant. This saves you from having to specify the type when you use the event class.

While the CairngormEvent class does provide the data property for transferring data on the event ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required