A quick one about Signals / RL integration

stf's Avatar


04 Jun, 2010 12:17 PM

Hi all,

First of all thanks a lot to the people who did all the hard work, RL is the first framework I use in production (outside of customized MVC ones) and I have to say the more I use it, the more I like it.

But there's still something I don't get. I'm trying to map a Signal to a Command. So in the context (a SignalContext), I've got :

signalCommandMap.mapSignalClass(FullscreenRequested, ToggleFullscreen);

Inside a mediator (that mediates a button), I've added a reference to inject:

[Inject] public var fsEvent:FullscreenRequested;

Then inside a click event:


Pretty easy. I was then thinking that the command should be triggered, but it's not! I can see a trace in the click event but the command is neither fired nor even created. Any ideas?

  1. 1 Posted by mike.cann on 04 Jun, 2010 12:38 PM

    mike.cann's Avatar

    Hi Stef,

    I assume fsEvent isnt null as that would cause a null reference when you try to call dispatch. That means that it is getting the wrong instance from somewhere.

    Are you mapping a singleton to FullscreenRequested too?


  2. 2 Posted by stf on 04 Jun, 2010 12:51 PM

    stf's Avatar

    Yeah I did actually, inside the context (otherwise I would have had missing injection error):


    Sorry forgot to mention it.

  3. 3 Posted by mike.cann on 04 Jun, 2010 01:00 PM

    mike.cann's Avatar

    Ah, well im not sure what is going on with your missing injection but if you are mapping a signal to a command you shouldnt map a singleton too, that will cause a problem.


  4. 4 Posted by stf on 04 Jun, 2010 01:15 PM

    stf's Avatar

    Okay I removed the singleton in the context, so the only thing related to that Signal is the mapping to the Command:

    signalCommandMap.mapSignalClass(FullscreenRequested, ToggleFullscreen);

    I tried to create an instance of the Signal in the mediator:

    private var fsEvent:FullscreenRequested;

    then dispatch it. But once again, the mapping just doesnt work. Any ideas for a workaround to handle that?

  5. 5 Posted by mike.cann on 04 Jun, 2010 01:19 PM

    mike.cann's Avatar

    Did you mean private:

    private var fsEvent:FullscreenRequested;

    As this wont be recognised by the injector if you want it to be injected it must be public and decorated with [Inject] so:

    [Inject] public var fsEvent:FullscreenRequested;


  6. Support Staff 6 Posted by Shaun Smith on 04 Jun, 2010 01:20 PM

    Shaun Smith's Avatar

    I'm not too familiar with the SignalCommandMap, but I do know that Joel just released a bugfix (yesterday). Are you running the latest versions of RL (v1.1.0 beta8) and SignalCommandMap?

  7. Support Staff 7 Posted by Joel Hooks on 04 Jun, 2010 03:03 PM

    Joel Hooks's Avatar

    This is related to the bugfix from yesterday related to RL1.1 and the SignalCommandMap utility. My apologies for this. The utility now has a unit test to cover this scenario ;)


  8. Joel Hooks closed this discussion on 04 Jun, 2010 03:03 PM.

  9. stf re-opened this discussion on 05 Jun, 2010 10:06 PM

  10. 8 Posted by stf on 05 Jun, 2010 10:06 PM

    stf's Avatar

    Wow that a was a perfect timing^^ I tested it and it works. Thanks!

  11. 9 Posted by stf on 10 Jun, 2010 01:23 PM

    stf's Avatar

    Got a similar problem now, inside a model proxy:

    The context links an Signal class to a Command:
    signalCommandMap.mapSignalClass(BufferManagerEvent, BufferManager);

    Then inside the model proxy:

    [Inject] public var buffermanagerEvent:BufferManagerEvent; buffermanagerEvent.dispatch();

    I'm using lots of Signals in that class (around 15), and they are all dispatched and catched by views for example. But this one is the only one that's related to a Command in the context (others are mapped as singletons). The Command is never fired, and no errors are returned.

  12. 10 Posted by stf on 14 Jun, 2010 09:36 AM

    stf's Avatar

    Just to make the post going up - anyone got any idea on that? The problem is pretty simple I guess, but I can't make it work!

  13. Stray closed this discussion on 10 Feb, 2011 05:27 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac