tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/541-mediator-not-registering-in-timeRobotlegs: Discussion 2012-05-05T13:20:37Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/150525452012-04-06T08:48:46Z2012-04-06T08:48:46ZMediator not registering in time.<div><p>Hi!</p>
<p>Possible solutions:</p>
<ul>
<li>use Stray’s RelaxedEventMap: <a href=
"https://github.com/Stray/robotlegs-utilities-RelaxedEventMap">https://github.com/Stray/robotlegs-utilities-RelaxedEventMap</a></li>
<li>pass your screenShot to your popup when you create it: access a
public method on your popup view</li>
<li>let popup’s mediator ask for the screenshot on its
onRegister(): dispatch an event to trigger a command …</li>
</ul>
<p>Does this help?<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/150525452012-04-06T15:56:40Z2012-04-06T15:56:40ZMediator not registering in time.<div><p>Hello Visnik,</p>
<p>When mediating a Flex component, the mediator waits for the
creationComplete event before invoking onRegister (if the component
is not initialized at the time of mediation):</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/blob/master/src/org/robotlegs/base/MediatorBase.as#L66">
https://github.com/robotlegs/robotlegs-framework/blob/master/src/or...</a></p>
<p>This explains the behaviour you are seeing. The purpose of that
code is to ensure that by the time you enter onRegister you can be
sure that the view component is ready to be interacted with.</p>
<p>You can change that behaviour by overriding preRegister, not
calling super, and instead immediately calling onRegister. But,
bear in mind that if you do that your UIComponent won't be
initialized by the time you start interacting with it and you might
run into issues related to that (null pointer exceptions for
example).</p>
<p>Hope that helps.</p></div>Shaun Smith