tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/693-clarification-on-multiple-event-types-to-one-commandRobotlegs: Discussion 2018-10-18T16:35:33Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/105866132011-10-12T22:12:26Z2011-10-12T22:12:26ZClarification on multiple event types to one Command.<div><p>I am mapping out a UML for an applicaion I will be building and
I was thinking of using one command for multiple event types. I was
looking at some posts and did not want to high jack them so i
thought i would create a new post here. In this [post] <a href=
"http://knowledge.robotlegs.org/discussions/questions/687-injecting-different-events">
http://knowledge.robotlegs.org/discussions/questions/687-injecting-...</a>)
user krasimir syas:</p>
<p><strong>Hello, just use: [Inject] public var
event:YourEventType; in your command. They by using event.type you
will be able to catch the different situations.</strong></p>
<p>So just for clarification one event class, with multiple event
types can be mapped to a single command without issue? I can take a
single event such as a <em>PageChangeEvent.NEXT</em> and a
<em>PageChangeEvent.Back</em> for example and map to a single
pageChangeCommand? just do something like the following?</p>
<pre>
<code>[Inject] public var nextEvent:PageChangeEvent.NEXT
[Inject] public var nextEvent:PageChangeEvent.BACK</code>
</pre>
<p>Is that even possible or proper?</p></div>visniktag:robotlegs.tenderapp.com,2009-10-18:Comment/105866132011-10-13T07:47:10Z2011-10-13T07:47:12ZClarification on multiple event types to one Command.<div><p>Hi Visnik,</p>
<pre>
<code>// Inject the PageChangeEvent
[Inject]
public var pageEvent:PageChangeEvent;
// Execute command
override public function execute():void
{
trace("This TYPE : " + pageEvent.type );
}</code>
</pre>
<p>Be sure to clone your PageChangeEvent...</p></div>Pierre Laveklinttag:robotlegs.tenderapp.com,2009-10-18:Comment/105866132011-10-13T17:46:22Z2011-10-13T17:46:22ZClarification on multiple event types to one Command.<div><p>cool, thanks</p></div>visnik