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.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 ...

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