PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: oklamos on April 23, 2009, 12:48:35



Title: two instance of component problem
Post by: oklamos on April 23, 2009, 12:48:35
Hello,

I have the following problem :
in my mxml app i have one componenet (DebugView) in two instances (ucGatewayDebugView  and ucSIMDebugView )

In the app mediator constractor i registered two mediators for the component:
            facade.registerMediator( new DebugViewMediator(app.ucGatewayDebugView ) );
            facade.registerMediator( new DebugViewMediator(app.ucSIMDebugView ) );

In the debugMediator i have the following function that add text line to textArea in the debugView Conponent:
 
             case ApplicationFacade.DATA_SHOW_IN_DEBUG:
                   showData(note.getBody() as String,COLOR_RECEIVE);
               break;
           
            .
            .
            .
       private function showData(sData:String,sColor:String):void
           {
             uc.txtDebug.text +=  sData ; // the line added only in ucGatewayDebugView !!
         
           }

the problem is that the debugMediator add the text line only in one component instance (ucGatewayDebugView )

Any advice please ?


Title: Re: two instance of component problem
Post by: puremvc on April 23, 2009, 06:44:24
Your mediators need to be registered with unique names. In the constructor of the mediator instead of just passing super the NAME constant you've defined for the mediator, try appending the id of the component like:

super(NAME+"/"+viewComponent.id, viewComponent);

-=Cliff> 


Title: Re: two instance of component problem
Post by: oklamos on April 23, 2009, 07:17:18
Thanks Cliff , its work now :)