0 Replies Latest reply on Mar 1, 2010 8:05 AM by liorchaga

    Navigation control best practice

    liorchaga

      After realizing that I can't dispatch a NavigationEvent through my mxml file, which I don't tend to configure in the context file, I used the presentation model to dispatch the event (see http://forums.adobe.com/message/2626422).

       

      However, I find it abusing to control navigation through the PM. It is not it's responsibility as I see it.

      I thought about using the ContentDestination class to do the job, configure it as a singleton parsley object, and inject it to the relevant mxml files.

       

      For example:

      package com.structures.main.presentation
      {
           import com.adobe.cairngorm.navigation.NavigationEvent;
           
           import flash.events.EventDispatcher;
           
      
           [Event(name="navigateTo", type="com.adobe.cairngorm.navigation.NavigationEvent")]
           [ManagedEvents(names="navigateTo")]
           public class MainContentDestination extends EventDispatcher
           {
                public static const BACK_OFFICE:String = "structures.backoffice";
                public static const LOGIN:String = "structures.login";
                
                public function navigateTo(destination:String):void{
                     dispatchEvent(NavigationEvent.newNavigateToEvent(destination));
                }     
           }
      }
      

       

       

      Any insights about it?

      Lior.