eventMap.mapListener question

Derrick Curry's Avatar

Derrick Curry

04 Jan, 2011 07:53 PM

In my view I'm dispatching an event when a UI component is interacted with. In the mediator for that view I have the following snippet of code.

`[Inject] public var view:ApplicationShell;

override public function onRegister():void
{

// Listen for framework events
eventMap.mapListener(eventDispatcher, ConfigEvent.LOADED, handleConfigLoaded);

// Listen for view events
eventMap.mapListener(view, ModuleEvent.LOAD, dispatch, ModuleEvent);

// Load the config file
dispatch(new ConfigEvent(ConfigEvent.LOAD, FlexGlobals.topLevelApplication.parameters.profile));

}`

The following command is mapped in my context.

commandMap.mapEvent(ModuleEvent.LOAD, LoadModuleCommand, ModuleEvent);

The only way I can get this command to fire is by using the following snippet of code to setup the view event listener.

addViewListener(ModuleEvent.LOAD, handleModuleLoad, ModuleEvent);

Shouldn't the eventMap.mapListener method work for setting up the view event listener?

  1. 1 Posted by krasimir on 04 Jan, 2011 08:27 PM

    krasimir's Avatar

    Hello,

    if I'm not wrong if you dispatch ModuleEvent.LOAD into your view your command will be called. Did you try that and if yes what was the result ?

  2. 2 Posted by krasimir on 04 Jan, 2011 08:28 PM

    krasimir's Avatar

    P.S. don't forget to override the clone method into your custom events.

  3. 3 Posted by Derrick Curry on 05 Jan, 2011 04:53 PM

    Derrick Curry's Avatar

    krasimir,

    Thanks for the help, the issue was that I didn't override the clone method in my custom events.

  4. Stray closed this discussion on 11 Feb, 2011 11:02 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