Injecting Event inside mediator when mediator is adding dynamically

armen abrahamyan's Avatar

armen abrahamyan

21 Mar, 2011 02:56 PM

Hi.
I have flex project. my second view is adding dynamically. So I'm maping mediator manually. The problem is that inside FlickrSelectedImageMediator i can't inject event.

In main context:
injector.mapSingleton(FlickrThumbDataEvent);
mediatorMap.mapView(FlcikrSelectedImage,FlickrSelectedImageMediator,null,false,false);

in the view mediator somewhere:
var selectedImage:FlcikrSelectedImage = PopUpManager.createPopUp(view, FlcikrSelectedImage, true) as FlcikrSelectedImage;
mediatorMap.createMediator( selectedImage );
PopUpManager.centerPopUp(selectedImage);

inside FlickrSelectedImageMediator:
[Inject] public var flickrThumbDataEvent: FlickrThumbDataEvent

the last inject of event inside mediator gives error:
Error: Injector is missing a rule to handle injection into target [class FlickrThumbDataEvent]. Target dependency: String, method: constructor, parameter: 1

Thanks for the help!

  1. 1 Posted by armen abrahamya... on 21 Mar, 2011 09:37 PM

    armen abrahamyan's Avatar

    I find workaround of the problem...
    Moved mediatorMap.createMediator( selectedImage ); to the controller class, in the same place opening the actual view via popupmanager and passing data from mediator to view via model.

    working example: http://abrahamyan.com/wp-content/uploads/2011/robotlegflickrsearch/...
    ThumbSelectCommand -> execute thats where everything is happening.

    thx!

  2. Stray closed this discussion on 24 Mar, 2011 12:06 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