package com.jc.mediator.input { /*DietApp * Copyright (c) 2011 * Author(s) - Joseph Columbe */ /* example trace statements for logging trace("\n", "Log - " + this + ". method()"); trace(" :: Note on what statement is doing"); */ /** ASDoc Description here **/ import com.jc.event.input.IngredientInputEvent; import com.jc.view.input.IngredientInput; import flash.events.FocusEvent; import org.robotlegs.mvcs.Mediator; public class IngredientInputMediator extends Mediator { //- PROPERTIES - // [Inject] public var ingredientInput:IngredientInput; //- CONSTRUCTOR - // public function IngredientInputMediator() { super(); } // - PUBLIC METHODS - // override public function onRegister():void { trace("\n", "Log - " + this + ".onRegister()"); trace(" :: the Ingredient Input View object has been injected, we have reference to that object"); // The event map lets us listen for events broadcasted by view elements trace(" :: listening for events broadcasted by the IngredientInput view component"); eventMap.mapListener(ingredientInput.Ingredient_TextFeild,FocusEvent.FOCUS_OUT, onExitFocus); } // - PRIVATE METHODS - // private function onExitFocus(event:FocusEvent):void { trace("\n", "Log - " + this + ".onExitFocus()"); trace(" :: Dispatching the IngredientInputEvent.ADD_INGREDIENT event"); dispatch(new IngredientInputEvent(IngredientInputEvent.ADD_INGREDIENT, event.currentTarget.text)); } } }