tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/743-is-it-possible-to-map-events-directly-from-contextviews-stage-without-contetxview-mediatorRobotlegs: Discussion 2018-10-18T16:35:35Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/120022232011-12-09T10:28:50Z2012-03-09T10:28:25ZIs it possible to map events directly from contextView's stage without contetxView Mediator?<div><p>Hey everyone,</p>
<p>My question is that - is it possible to map events from
contextView's(root) stage object without contextView Mediator?<br>
This is for communication with the flash that loads my robotlegs
flash app.<br>
The flash that loads my app calls
loader.content.dispatchEvent...</p></div>kaspartag:robotlegs.tenderapp.com,2009-10-18:Comment/120022232011-12-09T10:38:39Z2011-12-09T10:38:39ZIs it possible to map events directly from contextView's stage without contetxView Mediator?<div><p>Hi there,</p>
<p>There are 2 easy ways to achieve this:</p>
<ol>
<li>
<p>You can still use a mediator - just create it manually (check
out the API of mediator and you'll see how that's done). I'm not
sure why you specifically asked to do it without a contextView
Mediator... so that may not fit.</p>
</li>
<li>
<p>you can use a plain Actor (which has an instance of the
sharedEvent dispatcher) as a kind of lightweight mediator, to
listen for the events directly and then redispatch it on the shared
eventDispatcher so that commands etc can respond. Actor has an
eventMap so just create a singleton of that, inject or pass in the
stage object and then do your wiring.</p>
</li>
</ol>
<p>hth,</p>
<p>Stray</p></div>Straytag:robotlegs.tenderapp.com,2009-10-18:Comment/120022232011-12-09T12:34:31Z2012-03-09T10:28:25ZIs it possible to map events directly from contextView's stage without contetxView Mediator?<div><p>Thank you for your answer!</p>
<p>I started with an actor but in the end it looked essentially
like a command so I was hoping that it would be possible to use
just a command.</p>
<p>But how can I make the contextView's stage object available for
injection?</p>
<p>Another question - if I use the contextView mediator and my swf
is unloaded or deleted from the main swf that loaded it - will it
trigger the onRemove on contextView mediator?</p></div>kaspartag:robotlegs.tenderapp.com,2009-10-18:Comment/120022232011-12-09T14:44:58Z2011-12-09T14:44:58ZIs it possible to map events directly from contextView's stage without contetxView Mediator?<div><p>No problem,</p>
<p>I would just inject contextView itself and then get the stage
object from there.</p>
<p>And yes - if your swf is unloaded then onRemove in the mediator
for the contextView should be triggered as the contextView will no
longer be on the stage - unless you shut down the whole robotlegs
context before you actually remove it. But... race conditions at
unload can usually be avoided by explicitly deciding what needs to
happen in what order and then calling that sequence of events.</p>
<p>Stray</p></div>Stray