Signals & Commands: Multiple Params of Same Type?

Mike Cann's Avatar

Mike Cann

14 Mar, 2010 12:59 PM via web

Hi,

Not sure if this has already been asked, but its a common problem I am running into.

When using the Signal command map how does one use multiple params of the same type?

For example suppose I have the following signal:

class MySignal extends Signal
{

public function MySignal()
{
    super(MyClass,MyClass);
}

}

And in my SignalContext I map it to a command:

signalCommandMap.mapSignalClass( MySignal, MyCommand);

and then invoke the signal (in a proxy as an example):

class MyProxy extends Actor
{

[Inject] public var signal : MySignal;

public function MySignal()
{
    signal.dispatch(new MyClass(), new MyClass());
}

}

In the command how do I then identity each injected MyClass ?

Cheers,
Mike

  1. 2 Posted by willdady on 15 Mar, 2010 11:16 PM

    willdady's Avatar

    I believe you need to create a value object to compose your class instances ie. MyVO. The value object will then be strongly typed to your signal.

    Hopefully one of the RL guys (or Rob Penner?) can confirm.

  2. Support Staff 3 Posted by Joel Hooks on 15 Mar, 2010 11:22 PM

    Joel Hooks's Avatar

    Will is correct. By the nature of how the parameters are injected into the command instances values of the same type will not properly inject. Composing a MySignalData object is probably the best bet.

  3. Joel Hooks closed this discussion on 16 Mar, 2010 03:55 AM.

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