trouble with mapValue : error Injector is missing a rule to handle injection into target
Hi
im having trouble using injector.mapValue , i understand that mapSingleton effectively does the same thing but i need to instantiate the the object since its the return value of another operation.
i am performing this :
`private function LibraryLoaded(hexGfxLib:HexGraphicsLibrary ) : void {
injector.injectInto(hexGfxLib);
injector.mapValue(HexGraphicsLibrary,hexGfxLib,"HexGraphicsLibrary");
}`
in the execution of one command and then in the execution of the next command i inject :
`
[Inject(name="HexGraphicsLibrary")]
public var hexGfxLib : HexGraphicsLibrary;
`
the two commands are in sequence using the macrobot library for macro commands .
i am recieving the error :
Injector is missing a rule to handle injection into target [object initializeHexGrid]. Target dependency: org.robotlegs.demos.helloflash.model.library.reference::HexGraphicsLibrary
would anyone know the issue ?
( ive tried everything in the common problems section )
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 Abel de Beer on 31 Dec, 2010 04:51 PM
If you remove the
injector.injectInto(hexGfxLib);
line, the problem is probably gone. You don't need to call this method manually, because the dependencies for your HexGraphicsLibrary class will be automatically injected once an instance of is requested through thegetInstance()
method of the Injector.The documentation for the IInjector interface says about the
injectInto()
method: "The IInjector should throw an Error if it can't satisfy all dependencies of the injectee." This is exactly what is happening in your example.2 Posted by antoine.amassih on 31 Dec, 2010 06:22 PM
Hi Abel ,
Actually i started off by not having that line initiallly but i put it there as a trial ive removed it since and still no cigar
3 Posted by antoine.amassih on 31 Dec, 2010 07:09 PM
alright found the culprit actually has nothing to do with all of this it was a question of detaining the execution of the command that loads the lib before mapping it.
Thanks for the help
4 Posted by Abel de Beer on 01 Jan, 2011 05:00 PM
Good to hear you found the problem.
Stray closed this discussion on 11 Feb, 2011 11:00 PM.