Need some guidance on correct usage of Extensions

mike's Avatar

mike

21 Apr, 2013 12:57 AM

Hi there,

When I try to use an Extension class (implement IExtension) and I try to declare this variable inside the extension class

    [Inject]
    public var injector : Injector;

the injector value is always null. What I'm trying to do is move the blazeds/rpc objects into their own extension (or should that be a bundle) ?

Thanks for Rl2 - everything else is even nicer to work with :)

Mike

  1. Support Staff 1 Posted by creynders on 21 Apr, 2013 10:15 AM

    creynders's Avatar

    LOL with your user name. Naughty ;)

    AFAIK extensions aren't even handled by the injector, i.e. you can't inject instances into them. However, if you simply need a reference to the injector in your extension you can locate it in the context instance that is passed through to the extend method:

    public function extend(context:IContext):void{
        const injector : Injector = context.injector
    }
    
  2. 2 Posted by mike on 21 Apr, 2013 10:40 PM

    mike's Avatar

    Ha! I just noticed that - I'll fix that up ;-)

    Thanks for that info - very helpful....mind if I ask what the purpose of an extension is? Could it be used to say compile the extension to a separate swf/swc to be loaded as RSL?

    Many thanks!

  3. Support Staff 3 Posted by creynders on 22 Apr, 2013 10:35 AM

    creynders's Avatar

    From the readme:

    An extension integrates a single utility or library into a Robotlegs context.

    You can somewhat compare them to plugins, you can extend the framework functionalities with them.

    and a bundle:

    A bundle bundles up a selection of extensions and configurations into a single package.

  4. Support Staff 4 Posted by creynders on 16 May, 2013 09:34 AM

    creynders's Avatar

    I'm closing this for now, if you have any more questions let us know!

  5. creynders closed this discussion on 16 May, 2013 09:34 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