tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/195-contextview-is-not-accessiable-in-startupcommand-after-migrating-to-robotlegs-130Robotlegs: Discussion 2013-04-28T09:59:21Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/35198042010-10-27T05:02:49Z2010-10-27T05:02:50Zcontextview is not accessiable in startupCommand after migrating to robotlegs 1.3.0<div><p>Sorry forgot to attaching code, hope it'll make it easier to read</p>
<p><br />
public class Context extends org.robotlegs.mvcs.Context<br />
</p>
<pre><code>{
protected static const XML_CONFIG:XML =
<types>
<type name='com.viocorp.core.controls::StartupCommand'>
<field name='configModel'/>
</type>
</types>;
public function Context(contextView:DisplayObjectContainer, autoStart:Boolean = true)
{
injector = new SwiftSuspendersInjector(XML_CONFIG);
super(contextView, autoStart);
}
override public function startup():void
{
commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE, StartupCommand, ContextEvent, true);// on application start up, create an text component for testing purpose
injector.mapSingleton(ConfigModel);
//dispatchEvent(new ContextEvent(ContextEvent.STARTUP));
super.startup();
}
}</code></pre>
<p></p>
<p><br />
public class StartupCommand extends Command<br />
</p>
<pre><code>{
[Inject]
public var configModel:ConfigModel;
override public function execute():void {
trace(contextView, configModel);</code></pre>
<p>}
}
</p></div>Marstag:robotlegs.tenderapp.com,2009-10-18:Comment/35198042010-10-27T11:04:36Z2010-10-27T11:04:36Zcontextview is not accessiable in startupCommand after migrating to robotlegs 1.3.0<div><p>Hi,</p>
<p>Have you tried it without the XML config? If you are using the XML config so that you can compile with the Flash IDE, there is a better way: under Publish Setting select "Export SWC". That forces the Flash compiler to keep metadata. As far as I know, passing XML through to the SwiftSuspenders Injector constructor changes the behavior of the library significantly. Is there another reason why you are using that style of configuration?</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/35198042010-10-29T02:53:30Z2010-10-29T02:53:31Zcontextview is not accessiable in startupCommand after migrating to robotlegs 1.3.0<div><p>work like a charm, thank you!</p></div>tag:robotlegs.tenderapp.com,2009-10-18:Comment/35198042010-10-29T04:55:01Z2010-10-29T04:55:04Zcontextview is not accessiable in startupCommand after migrating to robotlegs 1.3.0<div><p>Hi Shaun,</p>
<p>We just realize the 'export swc' will boost the file size from 700k to 1m, and our client is a bit obsessed with file size, is there a workaround?</p>
<p>Thanks,<br />
Mars</p></div>Marstag:robotlegs.tenderapp.com,2009-10-18:Comment/35198042010-11-01T22:55:12Z2010-11-01T22:55:12Zcontextview is not accessiable in startupCommand after migrating to robotlegs 1.3.0<div><p>Hi Mars,</p>
<p>I'd recommend using the free MXMLC compiler (provided with the Flex SDK) to compile your project. Doing so will allow you to publish "Release Builds" (where all debugging info is stripped out) reducing file-size and improving performance. The Flash IDE is very bad at compiling SWF files (believe it or not!). All your visual (and audio) assets can be built in the Flash IDE and then bundled into a SWC file and used in your main project - a pretty nice workflow.</p></div>Shaun Smith