Clarification on multiple event types to one Command.

visnik's Avatar

visnik

12 Oct, 2011 10:12 PM

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] http://knowledge.robotlegs.org/discussions/questions/687-injecting-...) user krasimir syas:

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.

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 PageChangeEvent.NEXT and a PageChangeEvent.Back for example and map to a single pageChangeCommand? just do something like the following?

[Inject] public var nextEvent:PageChangeEvent.NEXT
[Inject] public var nextEvent:PageChangeEvent.BACK

Is that even possible or proper?

  1. 1 Posted by Pierre Laveklin... on 13 Oct, 2011 07:47 AM

    Pierre Laveklint's Avatar

    Hi Visnik,

    // Inject the PageChangeEvent
    [Inject]
    public var pageEvent:PageChangeEvent;
    
    // Execute command
    override public function execute():void
    {
         trace("This TYPE : " +  pageEvent.type );
    }
    

    Be sure to clone your PageChangeEvent...

  2. 2 Posted by visnik on 13 Oct, 2011 05:46 PM

    visnik's Avatar

    cool, thanks

  3. visnik closed this discussion on 18 Oct, 2011 10:01 PM.

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