Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
override public function onRegister():void { //mediatorName = "ViewMediatorName/A" //sharedType = "A"; //same thing for ControlPanelMediator sharedType = mediatorName.split("/")[1];}
private var sharedType:Stringprivate static const NAME:String;public function ViewMediator( viewComponent:View){ sharedType = viewComponent.type; super(getMediatorName(),viewComponent);}override public function getMediatorName():String{ return NAME+"/"+sharedType;}override public function handleNotification(note:INotification):void{ if ( note.getType() != sharedType) return; switch ( note.getName() ) { ... }}
//very simplified...for (var i:int = 0; i < dataConfig.length; i++) { ... facade.registerMediator(new ViewMediator()); facade.registerMediator(new ControlPanelMediator()); ...}
facade.registerMediator(new ViewMediator(dataId));...public function ViewMediator(dataId:String){ sharedType = dataId; super(getMediatorName());}override public function onRegister():void { viewComponent = new View();}
var view = new View(); view.sharedType = type; var med:ViewMediator = new ViewMediator(view); facade.registerMediator(med);
var view = new View(); var med:ViewMediator = new ViewMediator(view); med.sharedType = type; facade.registerMediator(med);
Until now, I have been pretty strict about not modifying the constructor arguments with the framework classes. I guess I thought that was best practice. But if mediator constructor arguments may be arranged, added, deleted, etc. freely, then how about I pass the type argument there directly?