contextview is not accessiable in startupCommand after migrating to robotlegs 1.3.0

Mars's Avatar

Mars

27 Oct, 2010 03:57 AM

Hi,

My team's been developing with robotlegs 1.0.3 and everything is fine, but after we tried to migrate to 1.3.0, contextview is no longer accessible and injected model no longer works in StartupCommand, is there any thing that we've done wrong?

Thanks
Mars

  1. 2 Posted by Mars on 27 Oct, 2010 05:02 AM

    Mars's Avatar

    Sorry forgot to attaching code, hope it'll make it easier to read


    public class Context extends org.robotlegs.mvcs.Context

    {
        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();
        }
    
    }


    public class StartupCommand extends Command

    {
    
        [Inject]
        public var configModel:ConfigModel;
    
        override public function execute():void {
            trace(contextView, configModel);

    } }

  2. Support Staff 3 Posted by Shaun Smith on 27 Oct, 2010 11:04 AM

    Shaun Smith's Avatar

    Hi,

    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?

  3. 4 Posted by mars.zhu on 29 Oct, 2010 02:53 AM

    's Avatar

    work like a charm, thank you!

  4. 5 Posted by Mars on 29 Oct, 2010 04:55 AM

    Mars's Avatar

    Hi Shaun,

    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?

    Thanks,
    Mars

  5. Support Staff 6 Posted by Shaun Smith on 01 Nov, 2010 10:55 PM

    Shaun Smith's Avatar

    Hi Mars,

    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.

  6. Stray closed this discussion on 18 Feb, 2011 07:08 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac