Signal in Service is null

JeffW.'s Avatar


06 Aug, 2011 05:14 PM

I'm trying to dispatch a signal from a service that receives external OSC messages using a Tuio as3 lib, but the signal doesn't exist.
I'm using the latest RL and Signals extension.

In my ApplicationContext I added:
injector.mapSingleton(Receiver); signalCommandMap.mapSignalClass(ParseReceivedDataSignal,ParseReceivedDataCommand);

The signal class, which extends Signal:
public class ParseReceivedDataSignal extends Signal { public function ParseReceivedDataSignal() { super(OSCMessage); } }

In the Receiver class, which extends Actor and implements IOSCListener (from the Tuio lib), I inject the signal:
[Inject] public var parseReceivedDataSignal:ParseReceivedDataSignal;

and dispatch:

but the signal traces null.

I also wonder how the Receiver class would know about the Signal? But I based this on the RL Signals Cafe example here
which seems to do the same.


  1. 1 Posted by pavel.fljot on 06 Aug, 2011 05:44 PM

    pavel.fljot's Avatar

    When do you try to access parseReceivedDataSignal? It will be available only after injection occurs, try to create [PostConstruct] public function onInjected():void{ should be available here }

  2. 2 Posted by neil on 06 Aug, 2011 05:45 PM

    neil's Avatar

    I presume that you have mapped the Signal into the injector:

  3. 3 Posted by JeffW. on 06 Aug, 2011 06:30 PM

    JeffW.'s Avatar

    thanks for te quick reply:).

    I'd tried [PostConstruct] but no luck

    and I tried - but am not using now (cos i read it could cause problems)

    Injecting and dispatching the same signal from a mediator class doesn't cause the same problems...

    I instantiate the service the same moment that I add the view of wich the mediator does diaptch the signal.

    Is it necessary to use an interface for a service?

  4. 4 Posted by JeffW. on 06 Aug, 2011 07:44 PM

    JeffW.'s Avatar

    well, this is driving me crazy,
    so I stripped it down to its simplest form,
    see the attachment.

    I 'd be grateful if you can take a look to see what I'm missing here!

  5. 5 Posted by neil on 06 Aug, 2011 07:45 PM

    neil's Avatar

    OK, but how are you mapping the Signal into the injector? your code does not show this

    You have to make sure that you map the same instance into the injector as you are mapping to the signalCommandMap

    var prdSignal:ISignal = new ParseReceivedDataSignal();

    injector mapValue(ParseReceivedDataSignal, prdSignal);



  6. 6 Posted by pavel.fljot on 06 Aug, 2011 07:51 PM

    pavel.fljot's Avatar


    oh the thing is that no injection happens into your TestService. Instead of using "var testService:TestService = new TestService();" in this particular example you should at least write

    var testService:TestService = injector.getInstance(TestService) as TestService;
  7. 7 Posted by JeffW. on 06 Aug, 2011 07:59 PM

    JeffW.'s Avatar

    ah great, it now works :)

    Thanks a lot, Pavel, I hadn't seen that way of injecting yet .

  8. 8 Posted by neil on 06 Aug, 2011 08:26 PM

    neil's Avatar

    you can't just create the TestService as normal:

    var testService:TestService = new TestService();


    you have to create it via the injector, either by using [Inject] or:

    var testService:TestService = injector.getInstance(TestService);

    and you will need to inject the Signal as per my previous post

  9. 9 Posted by neil on 06 Aug, 2011 08:27 PM

    neil's Avatar

    oh, late to the party again I see :-/

  10. 10 Posted by JeffW. on 06 Aug, 2011 08:30 PM

    JeffW.'s Avatar

    thanks anyway Neil :)

    It wasn't necessary for me to inject the signal the way you wrote, which btw gives an error because you can't pass an instance to the mapSignalClass method, which requires a Class name.

  11. 11 Posted by neil on 06 Aug, 2011 09:40 PM

    neil's Avatar

    ah, there's another method mapoSignal...
    but as long as it works

  12. 12 Posted by JeffW. on 07 Aug, 2011 11:13 AM

    JeffW.'s Avatar

    yes, it works, but the next step makes me wonder which way to go.

    So I'm receiving data now in the Receiver class, and I dispatch them with a Signal to a Command, which handles the data and sets resulting values in the Model. Now I want to dispatch these data from the Model, so that a Sender class can send osc packets, to which another app is listening.

    What sort of class should Sender be?
    I guess not a Service, because services normally only receive data and don't listen for evens/signals?
    I guess not a Mediator, because a mediator is normally hooked up to a view and the sender doens't need a view?
    Should I just use a command in which the data are sent?

  13. 13 Posted by pavel.fljot on 07 Aug, 2011 11:18 AM

    pavel.fljot's Avatar


    I think Sender is basically a Service, and can be triggered by Command (so Command is mapped to Signal, which dispatches from Model on update).

  14. 14 Posted by JeffW. on 07 Aug, 2011 11:50 AM

    JeffW.'s Avatar

    But then I'd need to listen for the Signal in the Service, right? Isn't that highly discouraged?
    Or do you mean that I should inject the Sender into the Command and call a method in Sender from the Command?

  15. 15 Posted by pavel.fljot on 07 Aug, 2011 11:56 AM

    pavel.fljot's Avatar

    Sender into Command

  16. 16 Posted by JeffW. on 07 Aug, 2011 03:23 PM

    JeffW.'s Avatar

    got it, and it works, I guess this thread can be closed..

  17. 17 Posted by pavel.fljot on 07 Aug, 2011 07:27 PM

    pavel.fljot's Avatar


    so you're doing some touch-screen development (TUIO)? Maybe you could join development
    The TUIO protocol integration is on TODO list, but I haven't worked with that at all, don't have any hardware for that =(

  18. 18 Posted by JeffW. on 07 Aug, 2011 07:36 PM

    JeffW.'s Avatar

    no, I'm using the as3 tuio library because it makes it easy to work with sending and receiving osc messages between Air and other apps...but thanks for suggesting the development participation.

  19. Ondina D.F. closed this discussion on 01 Nov, 2011 04: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