Can Robotlegs be used in a non-UI Flex project?

codecraig's Avatar

codecraig

13 Jan, 2010 12:30 PM

Can I use Robotlegs in an non-UI Flex project? Basically I have an app which extends mx.modules.ModuleBase and so there is no Flex UI. Essentially I want command, events, services and dependency injection. Just curious if there is some way to bootstrap RL without a Flex <mx:Application>

  1. 1 Posted by codecraig on 13 Jan, 2010 06:59 PM

    codecraig's Avatar

    I think this might answer my question: http://knowledge.robotlegs.org/discussions/questions/33-listening-f...

    I'll have to give it a whirl at some point.

  2. 2 Posted by Alastair on 13 Jan, 2010 07:28 PM

    Alastair's Avatar

    Robotlegs is not dependent on Flex but it is dependent on Flex Builder (or mxmlc) for dependency injection. I've used it for both Flex and ActionScript only projects. Create a context for your module and initialize it in your module's creationComplete handler and you're off and running with Robotlegs (bad pun intended).

  3. Support Staff 3 Posted by Shaun Smith on 13 Jan, 2010 07:38 PM

    Shaun Smith's Avatar

    You can use any of the RL "apparatus" (CommandMap, MediatorMap etc) in isolation - the Context is just a convenient place to bootstrap a typical application/system. From mvcs.Context:

        protected function get commandMap():ICommandMap
        {
            return _commandMap || (_commandMap = new CommandMap(eventDispatcher, injector, reflector));
        }
        // .. //
        protected function mapInjections():void
        {
            injector.mapValue(IReflector, reflector);
            injector.mapValue(IInjector, injector);
            injector.mapValue(IEventDispatcher, eventDispatcher);
            injector.mapValue(DisplayObjectContainer, contextView);
            injector.mapValue(ICommandMap, commandMap);
            injector.mapValue(IMediatorMap, mediatorMap);
            injector.mapValue(IViewMap, viewMap);
            injector.mapClass(IEventMap, EventMap);
        }
    

    You can easily design your own "context" (without extending mvcs.Context) that instantiates an Injector, any required apparatus, and maps the apparatus into the Injector.

  4. Stray closed this discussion on 13 Feb, 2011 06:36 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