tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/37-can-robotlegs-be-used-in-a-non-ui-flex-projectRobotlegs: Discussion 2013-04-28T10:30:29Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/8484042010-01-13T12:30:40Z2010-02-28T00:44:31ZCan Robotlegs be used in a non-UI Flex project?<div><p>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></p></div>codecraigtag:robotlegs.tenderapp.com,2009-10-18:Comment/8484042010-01-13T18:59:50Z2010-02-28T00:44:31ZCan Robotlegs be used in a non-UI Flex project?<div><p>I think this might answer my question: <a href=
"http://knowledge.robotlegs.org/discussions/questions/33-listening-for-events-from-context-in-class-that-does-not-extend-anything-from-rl">
http://knowledge.robotlegs.org/discussions/questions/33-listening-f...</a></p>
<p>I'll have to give it a whirl at some point.</p></div>codecraigtag:robotlegs.tenderapp.com,2009-10-18:Comment/8484042010-01-13T19:28:54Z2010-01-13T19:28:57ZCan Robotlegs be used in a non-UI Flex project?<div><p>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).</p></div>Alastairtag:robotlegs.tenderapp.com,2009-10-18:Comment/8484042010-01-13T19:38:00Z2010-01-13T19:38:00ZCan Robotlegs be used in a non-UI Flex project?<div><p>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:</p>
<pre>
<code> 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);
}</code>
</pre>
<p>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.</p></div>Shaun Smith