puremvc
|
|
« Reply #1 on: February 05, 2008, 09:19:05 » |
|
For an example of multiple instances of a view component / mediator pair see the HelloFlash demo. In that application HelloSprite is the view component, and it has a HelloSpriteMediator. Also, in that particular case, when you scroll the wheel on the mouse, the notification is sent to all HelloSpriteMediators, who scale their HelloSprite accordingly.
In the case you describe you have multiple instances of the same view component/Mediator pair associated with multiple instances of the same Proxy. When a given Proxy sends certain Notifications, we want only the specific Mediator instance that's displaying this Proxy's data to respond.
* The Proxy needs to be named in a similar manner, a unique id is used instead of the NAME constant. * Each unique Mediator instance needs to be given (or be able to extrapolate) the name of the Proxy instance it is specifically interested in. * The Proxy instance sets the type parameter of the Notification to its unique name before sending. * All Mediators interested in this Notification name are notified, but they use the type property of the Notification to disambiguate and determine if this is a Notification that this particular Mediator instance needs to act upon.
Hope this helps, -=Cliff>
|