Catching event's variables on a mapped command?

prettymuchbryce's Avatar

prettymuchbryce

26 Sep, 2011 02:27 AM

What is the best practice way to catch a parameter with a command. For example if I create a new event and set a variable on it.. how can I make sure my command catches this variable? and is this considered a bad practice?

  1. Support Staff 1 Posted by Stray on 26 Sep, 2011 09:03 PM

    Stray's Avatar

    Hi Bryce,

    You can inject the event - make sure you use the exact type that fired:

    [Inject] public var someEvent:SomeEventType;

    this gives you access to the event that triggered the Command - and then you can pick up the properties as normal.

    Not bad practice at all - event injection is the basis of the CommandMap being useful!

    Stray

    (Sorry about your thread being closed earlier - no idea how that happened)

  2. Ondina D.F. closed this discussion on 23 Dec, 2011 08:52 AM.

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