Created two instance use mapSingleton
Hi All,
I updated RL to 1.1.1, i find a bug:
1.in StartupCommand.as class, i maped a singleton class:HttpService and maped a Event class, like this:
injector.mapSingleton(HttpService);
commandMap.mapEvent(ContextEvent.STARTUP_COMPLETE,
InitHttpServiceCommand);
2.in InitHttpServiceCommand.as, i inject HttpService. like this:
[Inject]
public var
httpService:HttpService;
3.when i startup complete, in Flash Player 10.0.2.54, the RL created 2 instance. in Flash Player 10.1.50.4304 no bug.
4.i used describeType function to check HttpService.as, i find the 2 version flash player got different xml:
in Flash Player 10.0.2.54:
<constructor> <parametar index="1" type="*"
optional="true"/> </constructor>
in Flash Player 10.1.50.4304:
<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!
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
1 Posted by wersling on 18 Jun, 2010 02:23 AM
additional: the HttpService have a param:
public function HttpService(path:String = null)
{
}
Support Staff 2 Posted by Till Schneidere... on 18 Jun, 2010 08:32 AM
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
anymore.
For more information, please see the section "Problems with
constructor injection" in the SwiftSuspenders readme at
http://github.com/tschneidereit/SwiftSuspenders/#readme
Shaun Smith closed this discussion on 20 Jun, 2010 04:19 PM.