2 Replies Latest reply on Feb 23, 2010 4:42 PM by P.o.l.a.c.o

    Cairngorm Question

    andrewthorp

      This question is about Events in cairngorm. I am not talking about Events that are used with Commands, but Events that are only used internally in the application.

       

      For instance, in the ModelLocator, I have this:

       

      public function set productVO( newValue:ProductVO ):void {

      _productVO = newValue;

      dispatchEvent( new Event( EVENT_GOES_HERE, true ) );

      }

       

      I use this to update areas of the application.

       

      My question is this, does it make sense for me to put the EVENT_GOES_HERE as a static var in the ModelLocator, Or should I have another 'model,' know as GlobalConstants, that I store all of those in (because there could be many, plus other things, a static array of states, for instance).

       

      Any help would be appreciated!

        • 1. Re: Cairngorm Question
          andrewthorp Level 1

          Other things that I am wondering whether they should be in here or not are things like this:

           

          [Embed(source="/com/aceofsales/assets/images/icon_gift_card.png")]

          public static const ICON_GIFT_CARD:Class;

           

          The Gift Card icon is used in many places of the application, so I figured embedding it globally in one spot was better, but there are many items like this.

           

          The model locator is just getting cluttered, and I am wondering if it makes sense to move this stuff out.

          • 2. Re: Cairngorm Question
            P.o.l.a.c.o Level 1

            About the Event thing, maybe would be better to define a new event class and those constants as constants of that class or in other case in a constants class but outside the model locator. You won't want to include that class in other places just to get that constant.
            About the icon maybe you could include it in a external stylesheet sou you could be able to change it if you need without having to recompile your app.
            Are you using Cairngorm 2.1?