Created two instance use mapSingleton

wersling's Avatar


18 Jun, 2010 01:44 AM

Hi All,

I updated RL to 1.1.1, i find a bug: class, i maped a singleton class:HttpService and maped a Event class, like this:

injector.mapSingleton(HttpService); commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE, InitHttpServiceCommand);, i inject HttpService. like this:

[Inject] public var httpService:HttpService;

3.when i startup complete, in Flash Player, the RL created 2 instance. in Flash Player no bug.

4.i used describeType function to check, i find the 2 version flash player got different xml:

in Flash Player
<constructor> <parametar index="1" type="*" optional="true"/> </constructor>

in Flash Player
<constructor> <parametar index="1" type="String" optional="true"/> </constructor>

I guess this is the bug origin?

Who can help me fix the bug or give me some suggestion? thanks!

  1. 1 Posted by wersling on 18 Jun, 2010 02:23 AM

    wersling's Avatar

    additional: the HttpService have a param:

    public function HttpService(path:String = null)

    this.path = path;


  2. Support Staff 2 Posted by Till Schneidere... on 18 Jun, 2010 08:32 AM

    Till Schneidereit's Avatar

    This is a known problem in earlier versions of the Flash Player.
    Specifically, the bug causes describeType to return incomplete
    information about constructor parameters until the class has been
    instantiated at least once.

    As you have already found out, the bug is fixed in Flash Player 10.1.
    As SwiftSuspenders (the dependency injection solution used in
    Robotlegs) automatically detects if a dummy instance has to be
    instantiated based on the information it gets from describeType, it
    doesn't create the dummy instance in the newest Flash Player versions

    For more information, please see the section "Problems with
    constructor injection" in the SwiftSuspenders readme at

  3. Shaun Smith closed this discussion on 20 Jun, 2010 04:19 PM.

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