Modular Robot Legs

visnik's Avatar

visnik

03 Aug, 2011 07:54 PM

I am messing around with the Modular Utility written by Joel Hooks and I got a few warnings that I am not sure why I am getting them.

In my main context I have the following:

viewMap.mapType(IntroScreenModule);

in my IntroScreenModule I have the following based on Joel Hooks example:
module Tag

implements="org.robotlegs.utilities.modular.core.IModule"

in the script tag

`[Inject]

        public function set parentInjector(value:IInjector):void
        {
            context = new IntroModuleContext(this, value);
        }

        public function dispose():void
        {
            context.dispose();
            context = null;
        }`

my errors

3590: org.robotlegs.core:IInjector used where a Boolean value was expected. The expression will be type coerced to Boolean.

and

com.modules.intro.screen:IntroScreenModule is a module or application that is directly referenced. This will cause com.modules.intro.screen:IntroScreenModule and all of its dependencies to be linked in with ProjectShell. Using an interface is the recommended practice to avoid this'

  1. Support Staff 1 Posted by Ondina D.F. on 04 Aug, 2011 06:08 PM

    Ondina D.F.'s Avatar

    Hi Joe,

    I’m not sure, but maybe you have added the Module directly to your application
    <module:SomeModuleModule /> instead of using a loader

    and defined a namespace:
    xmlns: module ="yourpath.modules.*"

    In this case you are referencing it directly instead of using an interface.
    Make a simple application, where you load a module 1. by placing it directly in the mxml and defining a namespace and 2. using a ModuleLoader to see if in the second case the error disappears.

    But that’s all I can tell you, because I haven’t used the modular utility and I can’t try the demo right now. Hopefully someone else will help you to sort out the issue.

    Also search the forum for “modular”, maybe you’ll find an answer in one of the threads.

    And look at the http://knowledge.robotlegs.org/discussions/examples/6-links-to-robo..., maybe there are other modular demos as well.
    Cheers,
    Ondina

  2. 2 Posted by visnik on 09 Aug, 2011 08:53 PM

    visnik's Avatar

    Ok,

    I was able to get the

    com.modules.intro.screen:IntroScreenModule is a module or application that is   directly referenced. This will cause com.modules.intro.screen:IntroScreenModule and all of its dependencies to be linked in with ProjectShell. Using an interface is the recommended practice to avoid this
    

    error to go away, but I am still getting this warning:

    3590: org.robotlegs.core:IInjector used where a Boolean value was expected. The expression will be type coerced to Boolean. IntroScreenModule.mxml

    Of course Joel's ModularDoodads example is not pulling up the error so I am missing something. So what I did what place my code side by side to his. I am not sure if this warning will actually impact anything, but I'll show you all what I have so far.

    Joel's Code
    Main Applicaion ModularDoodads.mxml

    protected function addDoodad_clickHandler(event:MouseEvent):void
    {
        //Add a visual element to this container. 
        doodadHolder.addElement(new DoodadModule());
    }
    

    doodadHolder being a group container, DoodadModule, is of course the module being loaded in.

    My Code within my MainApp.mxml

    protected function onCreationComplete(event:FlexEvent):void
    {
       moduleContainer_group.addElement(new IntroScreenModule());
     }
    

    moduleContainer_group being a group container, IntroScreenModule, is the module being loaded in.

    Joel's ModularDoodadscontext

    override public function startup():void
    {
            //map the modules so that instances will be properly supplied (injected) with an injector.
            viewMap.mapType(LoggerModule);
            viewMap.mapType(DoodadModule);
    
            mediatorMap.mapView(ModularDoodads, ModuleDoodadsMediator);
     }
    

    My MainAppContext

    private function mapModules():void
    {
        //map the modules so that instances will be properly supplied (injected) with an injector.
        viewMap.mapType(IntroScreenModule);
    }
    

    the mapModules() method is called from within my startup() method within the context.

    now the module's and where I get the warning.
    Joel's code in his DoodadModule.mxml

    [Inject]
    public function set parentInjector(value:IInjector):void
    {
         context = new DoodadModuleContext(this,value);
     }
    

    My code within my IntroScreenModule.mxml and where I get the warning.

    [Inject]
    public function set parentInjector(value:IInjector):void
    {
    context = new IntroModuleContext(this, value); // throws warning on this line of   code.
    }
    

    In the context for the module I have not yet mapped anything, all I did was extend the ModuleContext as stated to do so with all contexts. For the most part I am trying to duplicate a fairly near 1:1 as to how Joel suggest using his Modular utility, but I get the warnning and his code does not.

    If anyone is familar with his modular utility and or the example located here, please let me know what I am missing as i have been going back and forth with this for days trying to figure it out.

    Thanks,

    OH and sorry for such a long post!

  3. 3 Posted by visnik on 09 Aug, 2011 11:48 PM

    visnik's Avatar

    OK, well it seems i figured out the 3590: org.robotlegs.core:IInjector used where a Boolean value was expected. The expression will be type coerced to Boolean. IntroScreenModule.mxml warning.

    It would seems as though I need to pass in 3 parameters when creating a new IntroModuleContext, instead of

    new IntroModuleContext(this, value);
    

    i need

    new IntroModuleContext(this, true, value);
    
  4. visnik closed this discussion on 10 Aug, 2011 11:21 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