Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Mediator dont listen for CUSTOM Events  (Read 5928 times)
isragaytan
Full Member
***
Posts: 22


View Profile Email
« on: May 14, 2009, 10:16:06 »

Hi Again   ;D

Now the issue of the day is..

My Mediator dont listen for CUSTOM events....

Here is the scenario:

I have my view that dispatch an Event like this:

private function buscarPersonaRfc():void{
            
            var evtObj:BusquedaRFCEvent=new BusquedaRFCEvent("BusquedaRFCEvent",txtRfc.text);

            dispatchEvent(evtObj);
            
            
         }

and in my Mediator i have..

override public function onRegister():void{
         
         //Referencia a la aplicacion principal
         APPNAME=BusquedaPersonas.NAME;
         
         buscarPersonaProxy=facade.retrieveProxy("BuscarPersonaProxy") as BuscarPersonaProxy;
         
         buscarPersona.addEventListener("BusquedaRFCEvent",PBuscarPersona);
      }


When i click on the propper button it doesnt happen anything!...

the strange thing its that if i dispatch another event (no custom event), an event like..
private function buscarPersonaRfc():void{
            
            dispatchEvent(new Event("buscaPersonaNombre",true));
            
            
         }


and in my mediator i have..

override public function onRegister():void{
         
         //Referencia a la aplicacion principal
         APPNAME=BusquedaPersonas.NAME;
         
         buscarPersonaProxy=facade.retrieveProxy("BuscarPersonaProxy") as BuscarPersonaProxy;
         
         buscarPersona.addEventListener("buscaPersonaNombre",PBuscarPersona);
      }

IT WORKS!!!....how am i missing. Do i have again register all the mediators in the ApplicationMediator???

Any guidelines?? Thanks to all, i am starting with this framework :D sorry for all my quiestions :D







Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: May 15, 2009, 07:52:33 »

Is bubbles = true for your event? Notice that when you create a new standard event, you set the bubbles parameter to true. If a child of the view dispatches the event then only the view has the opportunity to handle it. The mediator listening to that view will never be notified. If the event bubbles, then it will make it to the mediator.

-=Cliff>
Logged
isragaytan
Full Member
***
Posts: 22


View Profile Email
« Reply #2 on: May 18, 2009, 02:51:11 »

Thanks Cliff!

Now its working!!...

The problem as yo say its in the CUSTOM event..

my Code working on the custom Events its..

package org.cdi.cdiintegra.socios.views.events
{
   import flash.events.Event;

   public class BusquedaRFCEvent extends Event
   {
      
      public var strRfc:String;
   
      public function BusquedaRFCEvent(strRfc:String,type:String)
      {
         super(type,true,true);
         this.strRfc=strRfc;
      }
      
      override public function clone():Event{
         
         return new BusquedaRFCEvent(strRfc,type);   
      }
      
      }

   
}

Thanks a lot again!
Logged
Pages: [1]
Print