Is it possible to inject ContextView into managed objects?

peter.hall's Avatar

peter.hall

20 Aug, 2013 02:58 PM

I need to configure an object that can listen to events on the top level view. The object is part of a module that could be loaded into various windows so I can't just hard-wire it or use FlexGlobals.topLevelApplication.

I have tried injecting ContextView, but that doesn't work. I thought of specifically adding the ContextView to the injector - is there a better way?

  1. Support Staff 1 Posted by Shaun Smith on 20 Aug, 2013 03:04 PM

    Shaun Smith's Avatar

    You should be able to inject it:

    [Inject] public var contextView:ContextView;
    // ...
    contextView.view // is the reference to the view itself
    

    Does that not work for you?

  2. 2 Posted by peter.hall on 20 Aug, 2013 03:36 PM

    peter.hall's Avatar

    Yes it works :)
    The object I was not being injected into any other objects, so wasn't being configured yet itself. :/

  3. Ondina D.F. closed this discussion on 23 Sep, 2013 02:35 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