Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
// when a mediator is created and you want the mediator itself to create the component...override public function onRegister():void{ viewComponent = new ComponentToMediate(); sendNotification(ADD_TO_STAGE, viewComponent, 'type');}...
// when you want a command to handle it (inside of a command)override public function execute(note:INotification):void { .... facacde.registerMediator(new compMediator(new UIComponent()));}// then inside said mediatoroverride public function onRegister():void{ // mediator registered alert we need to add this component to stage sendNotification(ADD_TO_STAGE, viewComponent, 'type');}
handleNotification(note:INotification):void { switch(note.noteName()) { case 'createSomeChild': var comp:UIComponent = new UIComponent(); facade.egisterMediator(new CompMediator(comp)); viewComponent.addChild(comp); break; }}
private function get myCustomComponent():MyCustomComponent{ return viewComponent as MyCustomComponent;}