Return to Snippet

Revision: 6163
at May 2, 2008 00:03 by wintondeshong


Initial Code
/**
 * Base PureMVC Project
 */
package view
{
    import flash.display.Stage;
    import flash.events.MouseEvent;
    import org.puremvc.as3.interfaces.*;
    import org.puremvc.as3.patterns.mediator.Mediator;
    
	import ApplicationFacade;

    /**
     * A Mediator for interacting with the Stage.
     */
    public class StageMediator extends Mediator implements IMediator
    {
        // Cannonical name of the Mediator
        public static const NAME:String = "StageMediator";

        public function StageMediator( viewComponent:Object ) 
        {
            /**
             * pass the viewComponent to the superclass where 
             * it will be stored in the inherited viewComponent property
             */
            super( NAME, viewComponent );
        }

		/**
		 * StageMediator lists the INITIALIZE_SITE notification as an 
		 * event of interest. You may list as many notification 
		 * interests as needed.
		 */
        override public function listNotificationInterests():Array 
        {
            return [ 
            		ApplicationFacade.INITIALIZE_SITE
                   ];
        }

        /**
         * Called by the framework when a notification is sent that
         * this mediator expressed an interest in.
         */
        override public function handleNotification( note:INotification ):void 
        {
            switch ( note.getName() ) 
            {
            	/**
            	 * If the notification sent has a name matching 
            	 * ApplicationFacade.INITIALIZE_SITE then this code block will execute
            	 */
                case ApplicationFacade.INITIALIZE_SITE:     	
					initializeSite();
                  	break;
            }
        }
        
        /**
        * Called to handle the INITIALIZE_SITE notification.
        * Creates SiteMediator, NavMediator, BodyMediator to provide
        * PureMVC functionality to the varies view components of the application.
        */
        private function initializeSite():void
        {
			
        }

		/**
		 * Retrieves the viewComponent and casting it to type Stage
		 */
        protected function get stage():Stage
        {
            return viewComponent as Stage;
        }
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
PureMVC StageMediator Class Template

Initial Tags
class, textmate

Initial Language
Other