know which signal execute the command

PA-TH's Avatar


02 Nov, 2011 09:15 AM

Hello everybody!
Imagine that I map multiple signals to just one command.
Anyone knows how can I know inside the command which signal executed the command?

Thanks a lot.

  1. Support Staff 1 Posted by Ondina D.F. on 02 Nov, 2011 04:36 PM

    Ondina D.F.'s Avatar

    Hey PA-TH,

    There are lots of discussions about signals and commands on this forum.
    I’m not sure whether you’ve already seen them or not.
    Maybe there is an answer to your question.
    Please, let us know if you can’t find anything helpful.

    Thank you,

  2. 2 Posted by Michal Wroblews... on 02 Nov, 2011 08:44 PM

    Michal Wroblewski's Avatar

    Hi PA-TH,

    There are two options for knowing which signal instance dispatched the command. If you're using the simplest Signal you can pass its instance to the command. The other option is to use DeluxeSignal with IEvent object. It's like:

    var deluxeSignal:DeluxeSignal = new DeluxeSignal(this);
    deluxeSignal.dispatch(new GenericEvent(true));

    Then IEvent is the first parameter in handler function (just like in native events). You can access the instance of the signal by IEvent.signal

    I have a question for you. Why do you need to know which signal dispatched? Maybe there's a better solution for your problem.


  3. 3 Posted by PA-TH on 03 Nov, 2011 10:17 AM

    PA-TH's Avatar


    Thanks for the quick response!
    Both options working great!
    To pass the instance of the signal maybe is the more simple way.
    But I was thinking if there is a way to avoid to pass a parameter inside signal.
    So the thing that i want to do is ..
    I want to map more than one signal to the same command. After in the command, i need to know which signal executed the command to make some decisions after inside the command. I know that you can pass parameters inside the signal and to inject them after in the command. But I don't feel this way super clean.

    Thanks a lot,

  4. 4 Posted by Michal Wroblews... on 03 Nov, 2011 10:33 AM

    Michal Wroblewski's Avatar

    I think it would be better to split the command into two. Each signal would have its own Command and doing its job and each would dispatch a signal calling a command doing the common thing.


  5. 5 Posted by PA-TH on 03 Nov, 2011 10:37 AM

    PA-TH's Avatar

    Yes it's the most clean way.
    Thanks Michal for the quick and helpful response!


  6. Ondina D.F. closed this discussion on 09 Nov, 2011 02:03 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