package HelloWorld.Message
{
	import HelloWorld.Events.HelloWorldMessageEvent;
	
	import flash.events.Event;
	
	import org.robotlegs.mvcs.Mediator;
	
	public class MessageViewMediator extends Mediator
	{
		[inject]
		public var view:MessageView;
		
		public function MessageViewMediator()
		{			
			
		}		

		override public function onRegister():void
		{
			trace("I am Registered!");
			
			addContextListener(HelloWorldMessageEvent.MESSAGE_DISPATCHED, handleMessage);	
		}
		
		public function handleMessage(e:HelloWorldMessageEvent):void
		{
			view.text = e.message;
		}
	}
}