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

Show Posts

* | |

  Show Posts
Pages: 1 [2]
16  Announcements and General Discussion / General Discussion / Re: dispatch MouseEvent from view component on: May 19, 2009, 05:18:49
Sorry i sent before it was ended..

So lets continue...

:

private function sendEvent():void{

      //Instantiate the custom event
      var evtObj:CustomEvent=new CustomEvent(yourVarValue,"CustomEvent");

      //dispatch the Event
      dispatchEvent(evtObj);

}


Now in your Mediator.....

:

override public function onRegister():void{


yourComponentReference.addEventListener("CustomEvent",handleCustomEvent);
}

private function handleCustomEvent(evt:CustomEvent):void{
           
                 trace(evt.yourProperty);
}


Hope it helps!
17  Announcements and General Discussion / General Discussion / Re: dispatch MouseEvent from view component on: May 19, 2009, 05:11:48
Let me take this...

In order to work with CUSTOM events, your view has to dispatch the proper CUSTOM event to the Mediator.

So in our CUSTOM event we could have a chunk of code like this...

:
package events
{
import flash.events.Event;
public class CustomEvent extends Event
{

public var yourProperty:String;

public function CustomEvent (yourProperty,type:String)
{
                       //Important thing here its that has to bubbles with the second parameter set equal to true :D
super(type,true,true);
this.yourProperty=yourProperty;
}

override public function clone():Event{

return new CustomEvent (yourProperty,type);
}

}

}

Its really important that in the super function inside the constructor the second parameter its gonna set to true. (Bubbling stuff) Other wise it couldnt work.

Now on your component we have to dispatch the proper CUSTOM event. Dont forget in the top of your component add the metatag event with the custom event like this..

:
<mx:Metadata>
    [Event("CustomEvent",type="events.CustomEvent")]
</mx:Metadata>

Now we have to dispatch the CUSTOM event in a function , lets say that a button clicks and activates this function:

private function sendEvent():void{

      //Instantiate the custom event
      var evtObj:CustomEvent=new CustomEvent(yourVarValue,"CustomEvent");



}






18  Announcements and General Discussion / General Discussion / Re: Mediator dont listen for CUSTOM Events 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!
19  Announcements and General Discussion / General Discussion / Mediator dont listen for CUSTOM Events 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







20  Announcements and General Discussion / General Discussion / Re: Mediator Problem on: May 14, 2009, 07:14:25
Thanks again Cliff!!!..

Yesterday i saw a very nice example about diferred instanciation. (Slacker) since i have a tab in my main window..... This solved a lot of questions about the application. Also i saw how you can handle popups and its a little bit the same thing. I have to register the mediators! "on the fly...


Thanks a lot Cliff :D ...


21  Announcements and General Discussion / General Discussion / Re: Mediator Problem on: May 13, 2009, 06:19:56
Thanks Cliff i resolved the problem.! ;D

The problem was a reference in catalogs. Thats done!!!

Now i got a question about register views...

When i initialize the application i do it with the proper command for
example ViewPrepCommand like this..:

override public function execute(notification:INotification):void{
         
         var app:cdiintegra=notification.getBody() as cdiintegra;
         
         //Registro el mediador
         facade.registerMediator(new SolicitudSocioMediator(app.solicitudSocio));
         
}

If i have more views inside solicitudSocio component with the proper id.. do i have also register those views?? and the proper mediators???

If the answer is yes how can i do that?

something like this?...

override public function execute(notification:INotification):void{
         
         var app:cdiintegra=notification.getBody() as cdiintegra;
         
         //Registro el mediador
         facade.registerMediator(new SolicitudSocioMediator(app.solicitudSocio));

                   facade.registerMediator(new SolicitudSocioMediator(app.solicitudSocio.DatosSolicitudSocio));
         
}

Thanks PUREMVC  ;D



22  Announcements and General Discussion / General Discussion / Mediator Problem on: May 12, 2009, 12:43:43
Hello everyone!

I have a little complication in my Mediator.

Here is the scenario:

I am working with the pureMVC MultiCore.
At startup i prepare the proper proxy and views  for a data retrieval. This works fine
since all the calls are executed correctly. In the mediator i have a reference to my view
component and my proxy so i handle a notification like this:

 case ApplicationFacade.ObtenEstadosCiviles_finished:
                ApplicationFacade.getInstance(APPNAME).catalogosResult.ObtenEstadosCivilesResult = notification.getBody() as Array;
                  
               datosCompSolicitud.DatosPersonas.myCBEstadoCivil.data="Gc04IdEstadoCivil";   
               datosCompSolicitud.DatosPersonas.myCBEstadoCivil.labelField = "Gc04EstadoCivil";               
               datosCompSolicitud.DatosPersonas.myCBEstadoCivil.dataProvider=listProxy.getData().ObtenEstadosCivilesResult;
              
              
                 break;   

this works fine in the proper comboBox!

First question here its..

Why my notification.getBody() dont have anything? since i send in the proxy the proper notification like this..

private virtual function ObtenEstadosCivilesHandler(event:ResultEvent):void
        {                   
           //ObtenEstadosCiviles
           //Alert.show("Obteniendo resultados en el proxy");
           catalogos.ObtenEstadosCivilesResult=event.result as Array;
           setData(catalogos);
            sendNotification( ApplicationFacade.ObtenEstadosCiviles_finished, catalogos.ObtenEstadosCivilesResult );
       
           
        }

Second question and here is my headache

When i assign to another notification interest the data in the first combo dissapears...its important to say that i debug the listProxy and i have all the necesary data!!! it has the correct data

so..my code is

case ApplicationFacade.ObtenPaises_finished:
              
               ApplicationFacade.getInstance(APPNAME).catalogosResult.ObtenPaisesResult = notification.getBody() as Array;
              
              
               datosCompSolicitud.DatosPersonas.myCBPaisNacio.data="Gc06IdPais";
               datosCompSolicitud.DatosPersonas.myCBPaisNacio.labelField="Gc06Pais";
            datosCompSolicitud.DatosPersonas.myCBPaisNacio.dataProvider=listProxy.getData().ObtenPaisesResult;
              
                 break; 

I debug and the proxy has all the data.. I dont know what i am missing, i checked all the name instances everything necesary and i dont find the problem

Thanks in advance..
Pages: 1 [2]