tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/665-modular-using-robotlegs-2-with-no-viewsRobotlegs: Discussion 2013-01-12T12:48:36Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-21T07:11:47Z2012-12-21T07:11:48ZModular using robotlegs 2 with no views<div><p>Hello,</p>
<p>Is it possible to use context inheritance (parent, child)
without using views, because from what i saw modular extension
relies on modular views.</p>
<p>For example, to build a library in robotlegs that will be used
inside other applications and to have an option for that library to
be independent for AS3/FLEX projects or to be able to communicate
with parent context both ways.</p>
<p>The reason for this is in my use of flash first I build base and
then just later the views come as independent units.</p>
<p>I hope the question is clear enough :)</p></div>matejtag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-22T10:34:52Z2012-12-22T10:34:52ZModular using robotlegs 2 with no views<div><p>Hi Matej,</p>
<p>Sorry for the late response.</p>
<p>The question is clear enough:)</p>
<p>-If the module you’re loading is extending
spark.modules.Module and you add the moduleLoader to the stage,
even if it doesn’t contain visual components, the
module’s context will inherit everything it needs from the
parent context</p>
<p>-If you can’t add it to the stage, you can add the
moduleLoader or moduleLoader.child to the SystemManager, and before
doing so, you make use of the
viewManager.addContainer(moduleLoader)
[robotlegs.bender.extensions.viewManager]</p>
<p>-If you don’t want to add the module to the stage or to
the system manager, you can pass the parent injector on to it
through an interface:</p>
<p>(moduleLoader.child as
ISomeInterface).initContext(parentInjector);</p>
<p>or just the shared event dispatcher, depending on your
needs.</p>
<p>Personally, I don’t know of any other ways of creating a
viewless context. Shaun would be the one to shed more light on
this;)</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-22T12:42:31Z2012-12-22T12:42:31ZModular using robotlegs 2 with no views<div><p>Hello Matej</p>
<p>The Modularity extension does indeed rely on views on the
Display List. However, at the end of the day, all this extension
does is link the child's <code>injector.parent</code> to the
parent's injector:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/blob/master/src/robotlegs/bender/extensions/modularity/impl/ContextViewBasedExistenceWatcher.as#L75">
https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...</a></p>
<p>Or:</p>
<p><a href=
"https://github.com/robotlegs/robotlegs-framework/blob/master/src/robotlegs/bender/extensions/modularity/impl/ViewManagerBasedExistenceWatcher.as#L99">
https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...</a></p>
<p>If you have your own way to determine context "hierarchy" that
is not based on the display list structure, you can write your own
extension to do the same (linking the injectors). Just try to make
sure that the link has been made <em>before</em> the child context
has been initialized.</p>
<p>Of course, you don't <em>have</em> to write an extension to do
this, you could just do it manually, but it would probably be a
good idea if it's something you plan on using a lot.</p>
<p>Hope that helps</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-22T12:45:35Z2012-12-22T12:45:35ZModular using robotlegs 2 with no views<div><p>This does make me wonder if there should be a more "official"
way to do this. Perhaps there should be a method on the Context's
API, something like:
<code>parentContext.addChild(childContext)</code>?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-22T13:00:28Z2013-01-10T10:20:39ZModular using robotlegs 2 with no views<div><p>Hi Ondina,</p>
<p>I would like to add to Matej's question. Imagine I have a
Library that provides an interface to do some fileBrowsing
manipulation, such as saving, deleting or else. Meaning that it
uses through AIR the native windows for browsing selecting files
renaming etc...</p>
<p>Let's also say that this library is independant and it built on
Robotlegs2. As in the case of Matej this library has no class
extending the displayObject.</p>
<p>Now!, I have 2 cases of pure AS3 (no flex) applications, one
built on RL2 and the other has no RL.</p>
<p>In the case of the project without RL I will just create a
context in the Libb. No modularity needed. But in the second case,
which would be the proper way to pass the context of the
application to the lib expecting modularity?</p>
<p>I imagine they are already out there many modules/libs that
are/can_be built on RL2 and to profit of this modularity.</p></div>Gustavotag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-22T13:07:32Z2013-01-10T10:20:39ZModular using robotlegs 2 with no views<div><p>Hi Shaun,</p>
<p>I most definitely believe this is NECESSARY.</p>
<p>More and more me, as I presume more AS developers, am working
with AIR and ANE's and I believe that standardization would be well
received in this case.</p></div>Gustavotag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-23T11:49:04Z2012-12-23T11:49:04ZModular using robotlegs 2 with no views<div><p>Hi Gustavo,</p>
<p>Sorry for responding late, again, but since the world
didn’t end on Friday, my list of things to do before the end
of the year didn’t disappear either ;-)</p>
<blockquote>
<p>In the case of the project without RL I will just create a
context in the Libb. No modularity needed. But in the second case,
which would be the proper way to pass the context of the
application to the lib expecting modularity?</p>
</blockquote>
<p>If you mean loading another RL2 application into the current
one, the external application would be treated like any other
module (swf).<br>
Of course there are differences between loading an application and
loading a module, but they are not related to robotlegs.<br>
Framework specific is that both contexts, in the main app and in
the external one, should install the MVCSBundle(which includes the
ModularitExtension) and the ScopedEventDispatcherExtension, so they
can communicate through a shared event dispatcher.</p>
<p>An application isn’t “view-less”, because it
has to have a root display object, either Flex-Application or
as3-Sprite.</p>
<p>You said „pass the context of the application to the lib
expecting modularity”. Here, I don’t know exactly what
you mean :). Two applications sharing the same context? Or each
application with its own context and just communicating through a
shared event dispatcher?</p>
<blockquote>
<p>Perhaps there should be a method on the Context's API, something
like: parentContext.addChild(childContext)?</p>
</blockquote>
<p>@Shaun I also think this would be a good idea!</p>
<p>Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-23T19:39:38Z2012-12-23T19:39:38ZModular using robotlegs 2 with no views<div><p>Cool, thanks for the feedback, new beta version on the
way...</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152012-12-24T15:42:00Z2012-12-24T15:42:00ZModular using robotlegs 2 with no views<div><p>That’s great, Shaun :) Thank you!!</p>
<p>For everyone interested, here are the links to the new beta:<br>
<a href=
"https://github.com/robotlegs/robotlegs-framework/tree/master/src">https://github.com/robotlegs/robotlegs-framework/tree/master/src</a></p>
<p>and tests:<br>
<a href=
"https://github.com/robotlegs/robotlegs-framework/tree/master/test">
https://github.com/robotlegs/robotlegs-framework/tree/master/test</a></p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/229630152013-01-03T19:47:33Z2013-01-03T19:47:33ZModular using robotlegs 2 with no views<div><p>Hi, I'm closing this thread for now. Please re-open, or create a
new thread, if you have other questions.</p></div>Shaun Smith