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: two instance of component problem  (Read 7344 times)
oklamos
Newbie
*
Posts: 6


View Profile Email
« 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 ?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 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> 
Logged
oklamos
Newbie
*
Posts: 6


View Profile Email
« Reply #2 on: April 23, 2009, 07:17:18 »

Thanks Cliff , its work now :)
Logged
Pages: [1]
Print