creynders
|
 |
« on: May 20, 2008, 05:37:59 » |
|
I don't know if anybody'll have any use for this, but I wrote a small function which defers the registration of the mediator until the view component it mediates is created. (I hope it doesn't sin against the best practices ??)
Place this in ApplicationFacade:
public function deferMediatorRegistration( mediatorClass : Class, viewComponent : UIComponent ) : void{ var facade : ApplicationFacade = this; var listener : Function = function( event : FlexEvent ) : void { facade.registerMediator( new mediatorClass( event.target ) ); } viewComponent.addEventListener( FlexEvent.CREATION_COMPLETE, listener ); }
to use it (in, for instance, ApplicationMediator )
ApplicationFacade.getInstance().deferMediatorCreation( MyCustomMediator, app.myCustomComponent );
|