As mentioned in the previous chapter, there are at least two areas in which you can combine functionality to reduce the number of classes. These are your event and delegate classes.
Let's start with event classes. The idea here is to find sets of actions that center on a particular object. Take for example the standard MouseEvent class. This class defines events such as MOUSE_DOWN, MOUSE_OUT, and MOUSE_OVER (and 14 other non-inherited events). These of course are all things that can happen when the user is using the mouse. So one possible way to combine Cairngorm events is to look for individual event classes that center on a particular type of object and then use constants to define these different types of events (i.e., make them more like standard Flex events).
Currently you should have the following event classes:
Since the goal is to find sets of related behaviors, take a look at the list and ask yourself, "who" does this event? And by who, I am not necessarily referring to whatever triggered the event. That in many cases will be the user or the application. Perhaps a better way to phrase the question is "What object in the program does this behavior center on?" For example, ...
Get Professional Cairngorm™ now with O’Reilly online learning.
O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.