tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/9759-where-to-add-to-context-viewRobotlegs: Discussion 2014-03-11T08:47:55Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/315681602014-02-12T09:42:44Z2014-02-12T09:42:44ZWhere to add to context View<div><p>Hello,</p>
<blockquote>
<p>By the way I am really struggling with the lack of updated
examples. It's hard to be a RL2 newbe. :P</p>
</blockquote>
<p>Hmm, that's true, sadly. Hopefully, the discussions on this
forum can compensate the lack of examples/tutorials.</p>
<p>If you create your context in your 'Main' Sprite like this:</p>
<pre>
<code>private var _robotlegsContext:RobotlegsContext;
private function createRLContext():void
{
_robotlegsContext = new RobotlegsContext(this);
}</code>
</pre>
<p>you can use <strong>contextView.view</strong> to add children to
your 'Main'</p>
<pre>
<code>public class RobotlegsContext
{
private var _context:IContext;
public function RobotlegsContext(view:DisplayObjectContainer)
{
var contextView:ContextView = new ContextView(view);
_context = new Context()
.install(MVCSBundle)
.configure(ModelsConfig ,ServicesConfig, ControllersConfig, MediatorsConfig)
.configure(contextView);
///// ADD A CHILD TO THE CONTEXT VIEW:
contextView.view.addChild(new SomeView());
}
}</code>
</pre>
<p>You could as well add SomeView to the contextView.view in a
handler that runs after initialization:<br></p>
<pre>
<code>_contextView = new ContextView(view);
_context = new Context()
.afterInitializing(addChildren)
.install(MVCSBundle)
...the rest</code>
</pre>
<p>But, I think it is better to let the View itself handle the
adding and removing of children, if possible.</p>
<p>Hope that helps.<br>
Ondina</p></div>Ondina D.F.tag:robotlegs.tenderapp.com,2009-10-18:Comment/315681602014-02-12T09:49:37Z2014-02-12T09:49:37ZWhere to add to context View<div><p>Wow thank you for the quick reply. That really helps and I guess
I will excessively use this forum from now on.<br>
When I have gained the basic Knowledge I will try to add some
simple Hello World Examples somewhere to get the Word out.</p>
<p>Thank you.</p></div>dhagenblntag:robotlegs.tenderapp.com,2009-10-18:Comment/315681602014-02-12T10:16:42Z2014-02-12T10:16:42ZWhere to add to context View<div><p>Glad it helped:)</p>
<blockquote>
<p>When I have gained the basic Knowledge I will try to add some
simple Hello World Examples somewhere to get the Word out.</p>
</blockquote>
<p>Yes, that would be cool!!</p>
<p>I don't know whether you've seen these 2 examples, which work
with the latest rl2, for sure:<br>
<a href=
"https://github.com/probertson/robotlegs-examples-Simple">https://github.com/probertson/robotlegs-examples-Simple</a><br>
<a href=
"https://github.com/probertson/robotlegs-examples-Simple_NoFlex">https://github.com/probertson/robotlegs-examples-Simple_NoFlex</a></p>
<p>As for the other examples listed here: <a href=
"http://knowledge.robotlegs.org/discussions/examples/20-links-to-robotlegs-v2-articles-examples-demos-utilities-and-tutorials">
http://knowledge.robotlegs.org/discussions/examples/20-links-to-rob...</a></p>
<p>If you want to help our community, of course, only if your time
permits, you could fork some of them and make them work with the
latest rl2 version.</p></div>Ondina D.F.