PureMVC Architects Lounge

Announcements and General Discussion => Architecture => Topic started by: jbtellez on December 14, 2007, 02:32:27



Title: Mediator that does not extend Mediator
Post by: jbtellez on December 14, 2007, 02:32:27
I am porting a Flash project over to PureMVC. The project is a 'Memory' type game where the task is to match tiles in a grid.  Each Tile class really is a Mediator to a movie clip so I was inclined to set it up like the mediators in the sample PureMVC code. But I actually want Tile to inherit from a custom class rather than Mediator. After viewing the Framework source, it looks straight forward enough just have Tile implement IMediator.  But I was curious to see if there was a deeper reason to always extend Mediator that I wasn't noticing.

Thanks for the great project, PureMVC is now my homepage! ;D


Title: Re: Mediator that does not extend Mediator
Post by: puremvc on December 14, 2007, 03:44:38
Typically we want the view component to be seperate from its Mediator.The Mediator listens to the view component (the tile) for events (clicking perhaps) and responds by sending notifications or manipulating Proxies typically. It also listens for Notifications from the rest of the system, and responds by manipulating or passing data to its view component (tile.flip() perhaps.

The tile exposes an api to the Mediator for interaction. Methods, vars, events.

-=Cliff>