Request of explain >_<

pb221201's Avatar


29 Nov, 2009 05:30 AM

I am really fall in love this framework , spent all a day practice it .
However i am a novice programmer and really a stupid guy , spent a lot of time but learned a little.
I have severals doubts, i would be very happy if can get some tips :)

- what the named:String used for ? in mapValue mapClass and mapSingletonOf ??
- can give a pure as3 example or section of code that mediates various contexts in a master context(shell) ??
- The advantages of use DI are only for easy unit test and reduce coding ?? , can teach me more ? or some links ??
-Can explain more when is the need of injector.instantiate() ??
-i know in some cases i need to do the injection manually by injector.injectInto , if i do this in command isn't bad right ?
-What the mapRule used for ?? to inject anything???
-What the project name RobotLegs comes from ? any relationshiop with DI ? or just for fun ???? :P

In the source:
In EventMap
`protected function routeEventToListener(event:Event, listener:Function, originalEventClass:Class):void
var eventClass:Class = Object(event).constructor; // What the need of this ?? for error handing check?
if (event is originalEventClass)

Thx in advance , and sorry for the greed of so many requests ! ( i am a DI class - > so many documentation )

  1. Support Staff 1 Posted by Shaun Smith on 02 Dec, 2009 09:41 AM

    Shaun Smith's Avatar

    Hi pb221201,

    1. Named dependencies can be used like this:

    injector.mapValue( String, "", "homepage" );

    public var url;

    2. Pure as3 example coming soon.

    3. Dependency Injection, See:

    4. injector.instantiate() is useful when you need to create an instance and have all its dependencies satisfied. Robotlegs uses this function internally, and it is quite rare that you would need to use it yourself.

    5. Manually injecting: it is very unlikely that you will need to do this yourself. If you design your application with the Best Practices in mind, you shouldn't need to use injectInto(). See:

    6. mapRule() enables mapping multiple requests to the same response configuration.

    7. The Robotlegs name comes from a common problem with Dependency Injection called the "robot legs problem": How to create a robot with a two Leg objects, the left one injected with a LeftFoot, and the right one with a RightFoot. But only one Leg class that's reused in both contexts.

    8. routeEventToListener(): this enables Event type checking at runtime.

    In future, could you post separate questions (instead of putting them all together) - that will help other people who are looking for answers to those question. Thanks!

  2. Shaun Smith closed this discussion on 02 Dec, 2009 09:41 AM.

  3. pb221201 re-opened this discussion on 02 Dec, 2009 02:58 PM

  4. 2 Posted by pb221201 on 02 Dec, 2009 02:58 PM

    pb221201's Avatar

    Thx a lot Shaun Smith !
    it's very useful and now i can let my brain to relax for asking this questions
    i had a lot of fun with the framework and really surprised with the DI question,
    fantastic name the Robotlegs :)

    I saw the essential difference between a pro-programmer and a novice one ,
    ur have order the question with the numbers not like me with only " - "
    , i will take care of what u said and i won't feel so rare to post the 8 threads of questions :) , that's good idea that people can find it !

    Thx a again and sorry for my greed of question m m !

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

Keyboard shortcuts


? 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