6.3. How Do You Create One?

You create events by extending the com.adobe.cairngorm.control.Event class. Again, depending on what example you are looking at, the location for creating events will vary. The FStop application from the article "Flex 3: Introducing Cairngorm" (cited in previous chapters) creates events in the business.events package, as shown in (Figure 6-1).

Figure 6.1. Figure 6-1

The Cairngorm store creates events in an event package, as shown in (Figure 6-2).

Figure 6.2. Figure 6-2

For the purposes of creating an example event, we'll use the business.events package.

To create an event class, start as you would in creating any new class, but stop when the New ActionScript Class dialog box appears. The naming convention for events is to prefix the word event with something descriptive about the event. (You can see numerous examples of common names in (Figure 6-2).) Once you have entered a name for your event, either enter the full package and class name, com.adobe.cairngorm.control.Event, in the Superclass field (Figure 6-3), or use the Browse button and select CairngormEvent from the Open Type dialog (Figure 6-4).

Figure 6.3. Figure 6-3
Figure 6.4. Figure 6-4 ...

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.