6.2. What Do They Look Like?

The classes associated with Cairngorm events are located in the com.adobe.cairngorm.control package. The following classes are contained in this package:

  • 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

The CairngormEvent class is the class that the events you create will extend. The code for this class is as follows:

package com.adobe.cairngorm.control
{
   import flash.events.Event;
   public class CairngormEvent extends Event
   {
      private var _data : *;
      public function CairngormEvent( type : String, bubbles : Boolean = false,
cancelable : Boolean = false )
      {
         super( type, bubbles, cancelable );
      }
      public function dispatch() : Boolean
      {
         return CairngormEventDispatcher.getInstance().dispatchEvent( this );
      }
      public function get data() : *
      {
        return _data;
      }
      public function set data( value : * ) : void
      {
        _data = value;
      }
   }
}

Cairngorm events extend the standard flash.events.Event class but contain additional methods for interacting with the FrontController class.

The CairngormEvent class contains a single private property, _data, with associated getter and setter functions. This property has been provided as a method of passing data on a Cairngorm event when the developer does not want to subclass the CairngormEvent class.

The dispatch function is responsible ...

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.