How to inject multiple items of the same type using Signals and SignalCommand
I'm still getting used to Signals and the SignalCommand and I've run into an issue.
I have a signal which dispatches two strings:
loadUserImageSignal.dispatch('hello', 'world');
My signal class looks like this:
public function LoadUserImageSignal()
{
super(String, String);
}
Finally in my command I have this:
[Inject]
public var someString :String;
[Inject]
public var someOtherString :String;
Unfortunately when I do this both string vars in the command end up equalling 'world'. Any idea what I'm doing wrong?
Thank you!!!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | 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
1 Posted by odoe on 30 Jun, 2010 03:17 AM
I don't think the SignalCommandMap can deal with 2 objects of the same type in that manner.
It still uses the injector.MapValue(), which I'm sure someone would correct me if i'm wrong, can't distinguish between String 1 and String 2. I think this question has come up before and the suggested way of handling it was to create a valueObject to wrap them and pass that.
Support Staff 2 Posted by Joel Hooks on 30 Jun, 2010 03:20 AM
Dependency Injection (when performed by helper robots) has a really tough time with ambiguous data types.
3 Posted by rob on 30 Jun, 2010 04:19 AM
Yep I figured using a VO would be the best way to package things up. Thank you odoe and Joel for getting back to me. The RL forum is really a great place to get feedback :D