2 Replies Latest reply on Jan 8, 2010 1:25 PM by davidwaynegriffith

    Can't dispatch a Cairngorm event!

    uzairseedat

      I have a Cairngorm event:

       

       

       

       

      ////////////////////////////////////////////////////////////////////////////////////////// ///////////////

      ////////////////////////////////////////////////////////////////////////////////////////// ///////////////

       

      public class ChangeData extends CairngormEvent

      {

       

      //public static var EVENT_CHANGE_DATA:String = "ChangeData";

       

      public function ChangeData(type:String, bubbles:Boolean=false, cancelable:Boolean=false)

      {

       

      super(Charts_FrontController.EVENT_CHANGE_DATA);

      }

       

      }

       

      ////////////////////////////////////////////////////////////////////////////////////////// /////////////////

       

       

      I've declared the following in the FrontController:

       

      public static const Charts_FrontController.EVENT_CHANGE_DATA:String = "ChangeData";

       

       

      and now I can't get this to work:

       

       

      ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////

      import flash.events.Event;

      import com.adobe.cairngorm.control.CairngormEventDispatcher;

       

      public function ChangeData(e:MouseEvent):void

      {

       

      var ev:ChangeData = new ChangeData("ChangeData");

      CairngormEventDispatcher.getInstance().dispatchEvent(ev);

      }

       

      ////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////

       

      It gives me two errors:

       

      Type was not found or was not a compile time constant: ChangeData

      Method cannot be used as a constructor

       

       

       

      Please help

        • 1. Re: Can't dispatch a Cairngorm event!
          iamfuric Level 2

          change the method name  - it interferes with class name

          • 2. Re: Can't dispatch a Cairngorm event!
            davidwaynegriffith

             

            Event Code:

             

            package com.company.app.events

            {

             

                 import com.adobe.cairngorm.control.CairngormEvent;

             

             

                 public final class GenEvent extends CairngormEvent

                 {

                      public static const GEN_EVENT:String = "com.company.app.events.GenEvent";

             

                     

                      public function GenEvent()

                      {

                           super(GEN_EVENT);

                       }

                 }

            }

             

             

            Dispatching Event:

             

             

            import com.company.app.events.GenEvent;

             

            ....

             

            var evt:GenEvent = new GenEvent();

            evt.dispatch();

             

            // Cairngorm 2.x Events dispatch themselves...