tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/67-mediator-for-loaded-swfsRobotlegs: Discussion 2018-10-18T16:35:09Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/10854292010-02-23T11:39:44Z2010-02-23T11:39:44ZMediator for loaded swfs<div><p>Unfortunately, you cannot map Mediators to Interfaces -
Robotlegs <em>has</em> to know the concrete type in order to do
automatic mediation.</p>
<p>One way to work around this is to use the view's Fully Qualified
Class Name and the injectViewAs parameter:</p>
<pre>
mediatorMap.mapView( "com.example.view::MyComponent", MyMediator, IViewInterface );
</pre>
<p>This allows you to automatically mediate a View component by
referring to it by it's Fully Qualified Class Name, but to inject
it into the Mediator as an Interface.</p>
<p>You could even do the mapping at runtime, after the SWF has
loaded, and determine the FQCN using getQualifiedClassName:</p>
<pre>
mediatorMap.mapView( getQualifiedClassName( viewComponent ), MyMediator, IViewInterface );
</pre>
<p>Hope that helps!</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/10854292010-02-23T11:55:41Z2010-02-23T11:55:41ZMediator for loaded swfs<div><p>I'm using a facade / bridge to help mediate loaded swfs (that
aren't modules).</p>
<p>The swf loader provides the concrete class to mediate, and
simply passes through to the loaded swf. The swf and the swf loader
implement the same interface.</p>
<p>Avoids the need to do mapping at runtime, and I think it makes
testing easier as well as you can have the loader sub for the
loaded swf.</p>
<p>Just an alternative approach you could consider...</p></div>Stray