tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/417-know-which-signal-execute-the-commandRobotlegs: Discussion 2018-10-18T16:35:34Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/110430852011-11-02T16:36:17Z2011-11-02T18:43:16Zknow which signal execute the command <div><p>Hey PA-TH,</p>
<p>There are lots of discussions about signals and commands on this
forum.<br>
I’m not sure whether you’ve already seen them or
not.<br>
Maybe there is an answer to your question.<br>
Please, let us know if you can’t find anything helpful.</p>
<p>Thank you,<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/110430852011-11-02T20:44:46Z2011-11-03T08:01:22Zknow which signal execute the command <div><p>Hi PA-TH,</p>
<p>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:</p>
<pre>
<code>var deluxeSignal:DeluxeSignal = new DeluxeSignal(this);
deluxeSignal.dispatch(new GenericEvent(true));</code>
</pre>
<p>Then IEvent is the first parameter in handler function (just
like in native events). You can access the instance of the signal
by <a href=
"https://github.com/robertpenner/as3-signals/blob/master/src/org/osflash/signals/events/IEvent.as">
IEvent.signal</a></p>
<p>I have a question for you. Why do you need to know which signal
dispatched? Maybe there's a better solution for your problem.</p>
<p>Mike</p></div>Michal Wroblewskitag:robotlegs.tenderapp.com,2009-10-18:Comment/110430852011-11-03T10:17:26Z2011-11-03T10:17:28Zknow which signal execute the command <div><p>Hello!</p>
<p>Thanks for the quick response!<br>
Both options working great!<br>
To pass the instance of the signal maybe is the more simple
way.<br>
But I was thinking if there is a way to avoid to pass a parameter
inside signal.<br>
So the thing that i want to do is ..<br>
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.</p>
<p>Thanks a lot,<br>
PA-TH</p></div>PA-THtag:robotlegs.tenderapp.com,2009-10-18:Comment/110430852011-11-03T10:33:18Z2011-11-03T10:33:29Zknow which signal execute the command <div><p>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.</p>
<p>Mike</p></div>Michal Wroblewskitag:robotlegs.tenderapp.com,2009-10-18:Comment/110430852011-11-03T10:37:28Z2011-11-03T10:37:29Zknow which signal execute the command <div><p>Yes it's the most clean way.<br>
Thanks Michal for the quick and helpful response!</p>
<p>PA-TH</p></div>PA-TH