tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/63-from-puremvc-to-robotlegsbestpractices-for-startupRobotlegs: Discussion 2018-10-18T16:35:10Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/12890282010-03-23T11:00:53Z2010-03-23T11:03:01Zfrom PureMVC to RobotLegs...bestPractices for startup<div><p>Hi There,</p>
<p>Your formatting got a bit screwed up there, but I think what
you're looking for is ContextEvent.STARTUP_COMPLETE, for
example:</p>
<pre>
<code>package foo.bar
{
import foo.bar.command.BootstrapApplicationCommand;
import org.robotlegs.base.ContextEvent;
import org.robotlegs.mvcs.Context;
import flash.display.DisplayObjectContainer;
public class BarContext extends Context
{
public function BarContext(contextView : DisplayObjectContainer = null, autoStartup : Boolean = true)
{
super(contextView, autoStartup);
}
override public function startup() : void
{
// Executes BootstrapApplicationCommand as soon as this method completes.
commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE, BootstrapApplicationCommand, ContextEvent, true);
// Causes the ContextEvent.STARTUP_COMPLETE to be fired.
super.startup();
}
}
}</code>
</pre>
<p>To answer your questions directly; most people are content with
putting their Command Mappings, Mediator Mappings and Injector
Mappings into their Context's startup() method. However, I
personally prefer to have a Bootstrap Command which itself calls a
chain of Commands to get things setup and ready to roll.</p>
<p>Jonny.</p></div>Jonny Reeves