tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/247-how-can-i-pass-varialbes-to-a-popupRobotlegs: Discussion 2018-10-18T16:35:15Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/25897312010-08-16T09:29:45Z2010-08-16T09:29:45ZHow can I pass variables to a popup?<div><p>The way I have handled this is to do the following in my command (params passed on the custom event):</p>
<p>[Inject]
public var event:ShowPopUpEvent;<br />
</p>
<p>override public function execute():void<br />
{ <br />
</p>
<pre><code>injector.mapValue(ShowPopUpEvent,event);
createPopUpWindow();
injector.unmap(ShowPopUpEvent);</code></pre>
<p>}</p>
<p>protected function createPopUpWindow():void<br />
{</p>
<pre><code>var popUpWindow:PopUpWindow = new PopUpWindow();
PopUpManager.addPopUp(popUpWindow, contextView, true);
mediatorMap.createMediator(popUpWindow);</code></pre>
<p>}</p>
<p>Which should make the event available in the Mediator.</p>
<p>[Inject]
public var event:ShowPopUpEvent;</p>
<p>Cheers,</p>
<p>Simon</p></div>simontag:robotlegs.tenderapp.com,2009-10-18:Comment/25897312010-08-16T09:47:05Z2010-08-16T09:47:05ZHow can I pass variables to a popup?<div><p>I really don't like that work around sorry :)<br />
You should pass in your data to the pop up in the command</p></div>Nikos tag:robotlegs.tenderapp.com,2009-10-18:Comment/25897312010-08-16T10:06:47Z2010-08-16T10:06:47ZHow can I pass variables to a popup?<div><blockquote><p>I really don't like that work around sorry :)</p></blockquote>
<p>Hah, no need to apologise ;-)</p>
<p>Why do you think the data should be assigned to the popup in the command via property setting (just curious)? As opposed to simply ensuring the PopUp Mediator when registered has an Injection point defined to access this data?</p></div>simontag:robotlegs.tenderapp.com,2009-10-18:Comment/25897312010-08-16T10:16:24Z2010-08-16T10:16:24ZHow can I pass variables to a popup?<div><p>After thinking further I actually prefer your approach simon</p>
<p>Can't think of a better way to do it :)</p></div>Nikos tag:robotlegs.tenderapp.com,2009-10-18:Comment/25897312010-09-18T19:25:39Z2010-09-18T19:25:39ZHow can I pass variables to a popup?<div><p>Thanks a lot simon. Works like a charm!</p></div>christomanos